mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-10 00:50:38 +01:00
Introduce the use of Chromium types (issue #1336).
- Move include/cef_build.h to include/base/cef_build.h. - Move libcef_dll/cef_macros.h to include/base/cef_macros.h. - Move include/cef_trace_event.h to include/base/cef_trace_event.h and include/internal/cef_trace_event_internal.h. - Remove the "CEF_" prefix from TRACE macros. - Add new include/base/cef_logging.h and include/internal/cef_logging_internal.h for logging support. - Add new include/wrapper/cef_helpers.h for CEF_REQUIRE_*_THREAD macros and CefScopedArgArray. - Delete the util.h headers used by tests that duplicated the above functionality. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1767 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
b9781aa000
commit
6702fc573a
1
cef.gyp
1
cef.gyp
@ -985,6 +985,7 @@
|
|||||||
'libcef/browser/xml_reader_impl.h',
|
'libcef/browser/xml_reader_impl.h',
|
||||||
'libcef/browser/zip_reader_impl.cc',
|
'libcef/browser/zip_reader_impl.cc',
|
||||||
'libcef/browser/zip_reader_impl.h',
|
'libcef/browser/zip_reader_impl.h',
|
||||||
|
'libcef/common/base_impl.cc',
|
||||||
'libcef/common/breakpad_client.cc',
|
'libcef/common/breakpad_client.cc',
|
||||||
'libcef/common/breakpad_client.h',
|
'libcef/common/breakpad_client.h',
|
||||||
'libcef/common/cef_message_generator.cc',
|
'libcef/common/cef_message_generator.cc',
|
||||||
|
@ -9,14 +9,17 @@
|
|||||||
],
|
],
|
||||||
'variables': {
|
'variables': {
|
||||||
'includes_common': [
|
'includes_common': [
|
||||||
|
'include/base/cef_build.h',
|
||||||
|
'include/base/cef_logging.h',
|
||||||
|
'include/base/cef_macros.h',
|
||||||
|
'include/base/cef_trace_event.h',
|
||||||
'include/cef_base.h',
|
'include/cef_base.h',
|
||||||
'include/cef_pack_resources.h',
|
'include/cef_pack_resources.h',
|
||||||
'include/cef_pack_strings.h',
|
'include/cef_pack_strings.h',
|
||||||
'include/cef_runnable.h',
|
'include/cef_runnable.h',
|
||||||
'include/cef_trace_event.h',
|
|
||||||
'include/cef_version.h',
|
'include/cef_version.h',
|
||||||
'include/internal/cef_build.h',
|
|
||||||
'include/internal/cef_export.h',
|
'include/internal/cef_export.h',
|
||||||
|
'include/internal/cef_logging_internal.h',
|
||||||
'include/internal/cef_ptr.h',
|
'include/internal/cef_ptr.h',
|
||||||
'include/internal/cef_string.h',
|
'include/internal/cef_string.h',
|
||||||
'include/internal/cef_string_list.h',
|
'include/internal/cef_string_list.h',
|
||||||
@ -25,6 +28,7 @@
|
|||||||
'include/internal/cef_string_types.h',
|
'include/internal/cef_string_types.h',
|
||||||
'include/internal/cef_string_wrappers.h',
|
'include/internal/cef_string_wrappers.h',
|
||||||
'include/internal/cef_time.h',
|
'include/internal/cef_time.h',
|
||||||
|
'include/internal/cef_trace_event_internal.h',
|
||||||
'include/internal/cef_tuple.h',
|
'include/internal/cef_tuple.h',
|
||||||
'include/internal/cef_types.h',
|
'include/internal/cef_types.h',
|
||||||
'include/internal/cef_types_wrappers.h',
|
'include/internal/cef_types_wrappers.h',
|
||||||
@ -56,7 +60,6 @@
|
|||||||
'include/internal/cef_types_linux.h',
|
'include/internal/cef_types_linux.h',
|
||||||
],
|
],
|
||||||
'libcef_sources_common': [
|
'libcef_sources_common': [
|
||||||
'libcef_dll/cef_logging.h',
|
|
||||||
'libcef_dll/cpptoc/cpptoc.h',
|
'libcef_dll/cpptoc/cpptoc.h',
|
||||||
'libcef_dll/ctocpp/ctocpp.h',
|
'libcef_dll/ctocpp/ctocpp.h',
|
||||||
'libcef_dll/libcef_dll.cc',
|
'libcef_dll/libcef_dll.cc',
|
||||||
@ -67,8 +70,7 @@
|
|||||||
'<@(autogen_library_side)',
|
'<@(autogen_library_side)',
|
||||||
],
|
],
|
||||||
'libcef_dll_wrapper_sources_common': [
|
'libcef_dll_wrapper_sources_common': [
|
||||||
'libcef_dll/cef_logging.h',
|
'libcef_dll/base/cef_logging.cc',
|
||||||
'libcef_dll/cef_macros.h',
|
|
||||||
'libcef_dll/cpptoc/base_cpptoc.h',
|
'libcef_dll/cpptoc/base_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/cpptoc.h',
|
'libcef_dll/cpptoc/cpptoc.h',
|
||||||
'libcef_dll/ctocpp/base_ctocpp.h',
|
'libcef_dll/ctocpp/base_ctocpp.h',
|
||||||
@ -131,7 +133,6 @@
|
|||||||
'tests/cefclient/scheme_test.h',
|
'tests/cefclient/scheme_test.h',
|
||||||
'tests/cefclient/string_util.cpp',
|
'tests/cefclient/string_util.cpp',
|
||||||
'tests/cefclient/string_util.h',
|
'tests/cefclient/string_util.h',
|
||||||
'tests/cefclient/util.h',
|
|
||||||
'tests/cefclient/window_test.cpp',
|
'tests/cefclient/window_test.cpp',
|
||||||
'tests/cefclient/window_test.h',
|
'tests/cefclient/window_test.h',
|
||||||
'<@(cefclient_bundle_resources_common)',
|
'<@(cefclient_bundle_resources_common)',
|
||||||
@ -189,7 +190,6 @@
|
|||||||
'tests/cefclient/scheme_test.h',
|
'tests/cefclient/scheme_test.h',
|
||||||
'tests/cefclient/string_util.cpp',
|
'tests/cefclient/string_util.cpp',
|
||||||
'tests/cefclient/string_util.h',
|
'tests/cefclient/string_util.h',
|
||||||
'tests/cefclient/util.h',
|
|
||||||
'tests/cefclient/window_test.cpp',
|
'tests/cefclient/window_test.cpp',
|
||||||
'tests/cefclient/window_test.h',
|
'tests/cefclient/window_test.h',
|
||||||
'tests/cefclient/window_test_mac.mm',
|
'tests/cefclient/window_test_mac.mm',
|
||||||
@ -220,7 +220,6 @@
|
|||||||
'tests/cefsimple/simple_app.h',
|
'tests/cefsimple/simple_app.h',
|
||||||
'tests/cefsimple/simple_handler.cpp',
|
'tests/cefsimple/simple_handler.cpp',
|
||||||
'tests/cefsimple/simple_handler.h',
|
'tests/cefsimple/simple_handler.h',
|
||||||
'tests/cefsimple/util.h',
|
|
||||||
],
|
],
|
||||||
'cefsimple_sources_win': [
|
'cefsimple_sources_win': [
|
||||||
'tests/cefsimple/cefsimple.exe.manifest',
|
'tests/cefsimple/cefsimple.exe.manifest',
|
||||||
|
@ -28,15 +28,17 @@
|
|||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_INTERNAL_CEF_BUILD_H_
|
#ifndef CEF_INCLUDE_BASE_CEF_BUILD_H_
|
||||||
#define CEF_INCLUDE_INTERNAL_CEF_BUILD_H_
|
#define CEF_INCLUDE_BASE_CEF_BUILD_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if defined(BUILDING_CEF_SHARED)
|
#if defined(BUILDING_CEF_SHARED)
|
||||||
|
// When building CEF include the Chromium header directly.
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
|
|
||||||
#else // !BUILDING_CEF_SHARED
|
#else // !BUILDING_CEF_SHARED
|
||||||
|
// The following is substantially similar to the Chromium implementation.
|
||||||
|
// If the Chromium implementation diverges the below implementation should be
|
||||||
|
// updated to match.
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#ifndef OS_WIN
|
#ifndef OS_WIN
|
||||||
@ -89,41 +91,6 @@
|
|||||||
#define OVERRIDE
|
#define OVERRIDE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ALLOW_THIS_IN_INITIALIZER_LIST
|
|
||||||
#if defined(COMPILER_MSVC)
|
|
||||||
|
|
||||||
// MSVC_PUSH_DISABLE_WARNING pushes |n| onto a stack of warnings to be disabled.
|
|
||||||
// The warning remains disabled until popped by MSVC_POP_WARNING.
|
|
||||||
#define MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \
|
|
||||||
__pragma(warning(disable:n))
|
|
||||||
|
|
||||||
// MSVC_PUSH_WARNING_LEVEL pushes |n| as the global warning level. The level
|
|
||||||
// remains in effect until popped by MSVC_POP_WARNING(). Use 0 to disable all
|
|
||||||
// warnings.
|
|
||||||
#define MSVC_PUSH_WARNING_LEVEL(n) __pragma(warning(push, n))
|
|
||||||
|
|
||||||
// Pop effects of innermost MSVC_PUSH_* macro.
|
|
||||||
#define MSVC_POP_WARNING() __pragma(warning(pop))
|
|
||||||
|
|
||||||
// Allows |this| to be passed as an argument in constructor initializer lists.
|
|
||||||
// This uses push/pop instead of the seemingly simpler suppress feature to avoid
|
|
||||||
// having the warning be disabled for more than just |code|.
|
|
||||||
//
|
|
||||||
// Example usage:
|
|
||||||
// Foo::Foo() : x(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(y(this)), z(3) {}
|
|
||||||
//
|
|
||||||
// Compiler warning C4355: 'this': used in base member initializer list:
|
|
||||||
// http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx
|
|
||||||
#define ALLOW_THIS_IN_INITIALIZER_LIST(code) MSVC_PUSH_DISABLE_WARNING(4355) \
|
|
||||||
code \
|
|
||||||
MSVC_POP_WARNING()
|
|
||||||
#else // !COMPILER_MSVC
|
|
||||||
|
|
||||||
#define ALLOW_THIS_IN_INITIALIZER_LIST(code) code
|
|
||||||
|
|
||||||
#endif // !COMPILER_MSVC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // !BUILDING_CEF_SHARED
|
#endif // !BUILDING_CEF_SHARED
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_INTERNAL_CEF_BUILD_H_
|
#endif // CEF_INCLUDE_BASE_CEF_BUILD_H_
|
744
include/base/cef_logging.h
Normal file
744
include/base/cef_logging.h
Normal file
@ -0,0 +1,744 @@
|
|||||||
|
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
|
||||||
|
// Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||||
|
// Framework nor the names of its contributors may be used to endorse
|
||||||
|
// or promote products derived from this software without specific prior
|
||||||
|
// written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// The contents of this file are only available to applications that link
|
||||||
|
// against the libcef_dll_wrapper target.
|
||||||
|
//
|
||||||
|
// WARNING: Logging macros should not be used in the main/browser process before
|
||||||
|
// calling CefInitialize or in sub-processes before calling CefExecuteProcess.
|
||||||
|
//
|
||||||
|
// Instructions
|
||||||
|
// ------------
|
||||||
|
//
|
||||||
|
// Make a bunch of macros for logging. The way to log things is to stream
|
||||||
|
// things to LOG(<a particular severity level>). E.g.,
|
||||||
|
//
|
||||||
|
// LOG(INFO) << "Found " << num_cookies << " cookies";
|
||||||
|
//
|
||||||
|
// You can also do conditional logging:
|
||||||
|
//
|
||||||
|
// LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
|
||||||
|
//
|
||||||
|
// The CHECK(condition) macro is active in both debug and release builds and
|
||||||
|
// effectively performs a LOG(FATAL) which terminates the process and
|
||||||
|
// generates a crashdump unless a debugger is attached.
|
||||||
|
//
|
||||||
|
// There are also "debug mode" logging macros like the ones above:
|
||||||
|
//
|
||||||
|
// DLOG(INFO) << "Found cookies";
|
||||||
|
//
|
||||||
|
// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
|
||||||
|
//
|
||||||
|
// All "debug mode" logging is compiled away to nothing for non-debug mode
|
||||||
|
// compiles. LOG_IF and development flags also work well together
|
||||||
|
// because the code can be compiled away sometimes.
|
||||||
|
//
|
||||||
|
// We also have
|
||||||
|
//
|
||||||
|
// LOG_ASSERT(assertion);
|
||||||
|
// DLOG_ASSERT(assertion);
|
||||||
|
//
|
||||||
|
// which is syntactic sugar for {,D}LOG_IF(FATAL, assert fails) << assertion;
|
||||||
|
//
|
||||||
|
// There are "verbose level" logging macros. They look like
|
||||||
|
//
|
||||||
|
// VLOG(1) << "I'm printed when you run the program with --v=1 or more";
|
||||||
|
// VLOG(2) << "I'm printed when you run the program with --v=2 or more";
|
||||||
|
//
|
||||||
|
// These always log at the INFO log level (when they log at all).
|
||||||
|
// The verbose logging can also be turned on module-by-module. For instance,
|
||||||
|
// --vmodule=profile=2,icon_loader=1,browser_*=3,*/chromeos/*=4 --v=0
|
||||||
|
// will cause:
|
||||||
|
// a. VLOG(2) and lower messages to be printed from profile.{h,cc}
|
||||||
|
// b. VLOG(1) and lower messages to be printed from icon_loader.{h,cc}
|
||||||
|
// c. VLOG(3) and lower messages to be printed from files prefixed with
|
||||||
|
// "browser"
|
||||||
|
// d. VLOG(4) and lower messages to be printed from files under a
|
||||||
|
// "chromeos" directory.
|
||||||
|
// e. VLOG(0) and lower messages to be printed from elsewhere
|
||||||
|
//
|
||||||
|
// The wildcarding functionality shown by (c) supports both '*' (match
|
||||||
|
// 0 or more characters) and '?' (match any single character)
|
||||||
|
// wildcards. Any pattern containing a forward or backward slash will
|
||||||
|
// be tested against the whole pathname and not just the module.
|
||||||
|
// E.g., "*/foo/bar/*=2" would change the logging level for all code
|
||||||
|
// in source files under a "foo/bar" directory.
|
||||||
|
//
|
||||||
|
// There's also VLOG_IS_ON(n) "verbose level" condition macro. To be used as
|
||||||
|
//
|
||||||
|
// if (VLOG_IS_ON(2)) {
|
||||||
|
// // do some logging preparation and logging
|
||||||
|
// // that can't be accomplished with just VLOG(2) << ...;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// There is also a VLOG_IF "verbose level" condition macro for sample
|
||||||
|
// cases, when some extra computation and preparation for logs is not
|
||||||
|
// needed.
|
||||||
|
//
|
||||||
|
// VLOG_IF(1, (size > 1024))
|
||||||
|
// << "I'm printed when size is more than 1024 and when you run the "
|
||||||
|
// "program with --v=1 or more";
|
||||||
|
//
|
||||||
|
// We also override the standard 'assert' to use 'DLOG_ASSERT'.
|
||||||
|
//
|
||||||
|
// Lastly, there is:
|
||||||
|
//
|
||||||
|
// PLOG(ERROR) << "Couldn't do foo";
|
||||||
|
// DPLOG(ERROR) << "Couldn't do foo";
|
||||||
|
// PLOG_IF(ERROR, cond) << "Couldn't do foo";
|
||||||
|
// DPLOG_IF(ERROR, cond) << "Couldn't do foo";
|
||||||
|
// PCHECK(condition) << "Couldn't do foo";
|
||||||
|
// DPCHECK(condition) << "Couldn't do foo";
|
||||||
|
//
|
||||||
|
// which append the last system error to the message in string form (taken from
|
||||||
|
// GetLastError() on Windows and errno on POSIX).
|
||||||
|
//
|
||||||
|
// The supported severity levels for macros that allow you to specify one
|
||||||
|
// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
|
||||||
|
//
|
||||||
|
// Very important: logging a message at the FATAL severity level causes
|
||||||
|
// the program to terminate (after the message is logged).
|
||||||
|
//
|
||||||
|
// There is the special severity of DFATAL, which logs FATAL in debug mode,
|
||||||
|
// ERROR in normal mode.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CEF_INCLUDE_BASE_CEF_LOGGING_H_
|
||||||
|
#define CEF_INCLUDE_BASE_CEF_LOGGING_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if defined(DCHECK)
|
||||||
|
// Do nothing if the macros provided by this header already exist.
|
||||||
|
// This can happen in cases where Chromium code is used directly by the
|
||||||
|
// client application. When using Chromium code directly always include
|
||||||
|
// the Chromium header first to avoid type conflicts.
|
||||||
|
#elif defined(BUILDING_CEF_SHARED)
|
||||||
|
// When building CEF include the Chromium header directly.
|
||||||
|
#include "base/logging.h"
|
||||||
|
#else // !BUILDING_CEF_SHARED
|
||||||
|
// The following is substantially similar to the Chromium implementation.
|
||||||
|
// If the Chromium implementation diverges the below implementation should be
|
||||||
|
// updated to match.
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "include/base/cef_build.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
|
#include "include/internal/cef_logging_internal.h"
|
||||||
|
|
||||||
|
namespace cef_logging {
|
||||||
|
|
||||||
|
// Gets the current log level.
|
||||||
|
inline int GetMinLogLevel() {
|
||||||
|
return cef_get_min_log_level();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the current vlog level for the given file (usually taken from
|
||||||
|
// __FILE__). Note that |N| is the size *with* the null terminator.
|
||||||
|
template <size_t N>
|
||||||
|
int GetVlogLevel(const char (&file)[N]) {
|
||||||
|
return cef_get_vlog_level(file, N);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef int LogSeverity;
|
||||||
|
const LogSeverity LOG_VERBOSE = -1; // This is level 1 verbosity
|
||||||
|
// Note: the log severities are used to index into the array of names,
|
||||||
|
// see log_severity_names.
|
||||||
|
const LogSeverity LOG_INFO = 0;
|
||||||
|
const LogSeverity LOG_WARNING = 1;
|
||||||
|
const LogSeverity LOG_ERROR = 2;
|
||||||
|
const LogSeverity LOG_FATAL = 3;
|
||||||
|
const LogSeverity LOG_NUM_SEVERITIES = 4;
|
||||||
|
|
||||||
|
// LOG_DFATAL is LOG_FATAL in debug mode, ERROR in normal mode
|
||||||
|
#ifdef NDEBUG
|
||||||
|
const LogSeverity LOG_DFATAL = LOG_ERROR;
|
||||||
|
#else
|
||||||
|
const LogSeverity LOG_DFATAL = LOG_FATAL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// A few definitions of macros that don't generate much code. These are used
|
||||||
|
// by LOG() and LOG_IF, etc. Since these are used all over our code, it's
|
||||||
|
// better to have compact code for these operations.
|
||||||
|
#define COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ...) \
|
||||||
|
cef_logging::ClassName(__FILE__, __LINE__, cef_logging::LOG_INFO , \
|
||||||
|
##__VA_ARGS__)
|
||||||
|
#define COMPACT_GOOGLE_LOG_EX_WARNING(ClassName, ...) \
|
||||||
|
cef_logging::ClassName(__FILE__, __LINE__, cef_logging::LOG_WARNING , \
|
||||||
|
##__VA_ARGS__)
|
||||||
|
#define COMPACT_GOOGLE_LOG_EX_ERROR(ClassName, ...) \
|
||||||
|
cef_logging::ClassName(__FILE__, __LINE__, cef_logging::LOG_ERROR , \
|
||||||
|
##__VA_ARGS__)
|
||||||
|
#define COMPACT_GOOGLE_LOG_EX_FATAL(ClassName, ...) \
|
||||||
|
cef_logging::ClassName(__FILE__, __LINE__, cef_logging::LOG_FATAL , \
|
||||||
|
##__VA_ARGS__)
|
||||||
|
#define COMPACT_GOOGLE_LOG_EX_DFATAL(ClassName, ...) \
|
||||||
|
cef_logging::ClassName(__FILE__, __LINE__, cef_logging::LOG_DFATAL , \
|
||||||
|
##__VA_ARGS__)
|
||||||
|
|
||||||
|
#define COMPACT_GOOGLE_LOG_INFO \
|
||||||
|
COMPACT_GOOGLE_LOG_EX_INFO(LogMessage)
|
||||||
|
#define COMPACT_GOOGLE_LOG_WARNING \
|
||||||
|
COMPACT_GOOGLE_LOG_EX_WARNING(LogMessage)
|
||||||
|
#define COMPACT_GOOGLE_LOG_ERROR \
|
||||||
|
COMPACT_GOOGLE_LOG_EX_ERROR(LogMessage)
|
||||||
|
#define COMPACT_GOOGLE_LOG_FATAL \
|
||||||
|
COMPACT_GOOGLE_LOG_EX_FATAL(LogMessage)
|
||||||
|
#define COMPACT_GOOGLE_LOG_DFATAL \
|
||||||
|
COMPACT_GOOGLE_LOG_EX_DFATAL(LogMessage)
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
|
||||||
|
// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
|
||||||
|
// to keep using this syntax, we define this macro to do the same thing
|
||||||
|
// as COMPACT_GOOGLE_LOG_ERROR, and also define ERROR the same way that
|
||||||
|
// the Windows SDK does for consistency.
|
||||||
|
#define ERROR 0
|
||||||
|
#define COMPACT_GOOGLE_LOG_EX_0(ClassName, ...) \
|
||||||
|
COMPACT_GOOGLE_LOG_EX_ERROR(ClassName , ##__VA_ARGS__)
|
||||||
|
#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR
|
||||||
|
// Needed for LOG_IS_ON(ERROR).
|
||||||
|
const LogSeverity LOG_0 = LOG_ERROR;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// As special cases, we can assume that LOG_IS_ON(FATAL) always holds. Also,
|
||||||
|
// LOG_IS_ON(DFATAL) always holds in debug mode. In particular, CHECK()s will
|
||||||
|
// always fire if they fail.
|
||||||
|
#define LOG_IS_ON(severity) \
|
||||||
|
((::cef_logging::LOG_ ## severity) >= ::cef_logging::GetMinLogLevel())
|
||||||
|
|
||||||
|
// We can't do any caching tricks with VLOG_IS_ON() like the
|
||||||
|
// google-glog version since it requires GCC extensions. This means
|
||||||
|
// that using the v-logging functions in conjunction with --vmodule
|
||||||
|
// may be slow.
|
||||||
|
#define VLOG_IS_ON(verboselevel) \
|
||||||
|
((verboselevel) <= ::cef_logging::GetVlogLevel(__FILE__))
|
||||||
|
|
||||||
|
// Helper macro which avoids evaluating the arguments to a stream if
|
||||||
|
// the condition doesn't hold.
|
||||||
|
#define LAZY_STREAM(stream, condition) \
|
||||||
|
!(condition) ? (void) 0 : ::cef_logging::LogMessageVoidify() & (stream)
|
||||||
|
|
||||||
|
// We use the preprocessor's merging operator, "##", so that, e.g.,
|
||||||
|
// LOG(INFO) becomes the token COMPACT_GOOGLE_LOG_INFO. There's some funny
|
||||||
|
// subtle difference between ostream member streaming functions (e.g.,
|
||||||
|
// ostream::operator<<(int) and ostream non-member streaming functions
|
||||||
|
// (e.g., ::operator<<(ostream&, string&): it turns out that it's
|
||||||
|
// impossible to stream something like a string directly to an unnamed
|
||||||
|
// ostream. We employ a neat hack by calling the stream() member
|
||||||
|
// function of LogMessage which seems to avoid the problem.
|
||||||
|
#define LOG_STREAM(severity) COMPACT_GOOGLE_LOG_ ## severity.stream()
|
||||||
|
|
||||||
|
#define LOG(severity) LAZY_STREAM(LOG_STREAM(severity), LOG_IS_ON(severity))
|
||||||
|
#define LOG_IF(severity, condition) \
|
||||||
|
LAZY_STREAM(LOG_STREAM(severity), LOG_IS_ON(severity) && (condition))
|
||||||
|
|
||||||
|
#define SYSLOG(severity) LOG(severity)
|
||||||
|
#define SYSLOG_IF(severity, condition) LOG_IF(severity, condition)
|
||||||
|
|
||||||
|
// The VLOG macros log with negative verbosities.
|
||||||
|
#define VLOG_STREAM(verbose_level) \
|
||||||
|
cef_logging::LogMessage(__FILE__, __LINE__, -verbose_level).stream()
|
||||||
|
|
||||||
|
#define VLOG(verbose_level) \
|
||||||
|
LAZY_STREAM(VLOG_STREAM(verbose_level), VLOG_IS_ON(verbose_level))
|
||||||
|
|
||||||
|
#define VLOG_IF(verbose_level, condition) \
|
||||||
|
LAZY_STREAM(VLOG_STREAM(verbose_level), \
|
||||||
|
VLOG_IS_ON(verbose_level) && (condition))
|
||||||
|
|
||||||
|
#if defined (OS_WIN)
|
||||||
|
#define VPLOG_STREAM(verbose_level) \
|
||||||
|
cef_logging::Win32ErrorLogMessage(__FILE__, __LINE__, -verbose_level, \
|
||||||
|
::cef_logging::GetLastSystemErrorCode()).stream()
|
||||||
|
#elif defined(OS_POSIX)
|
||||||
|
#define VPLOG_STREAM(verbose_level) \
|
||||||
|
cef_logging::ErrnoLogMessage(__FILE__, __LINE__, -verbose_level, \
|
||||||
|
::cef_logging::GetLastSystemErrorCode()).stream()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VPLOG(verbose_level) \
|
||||||
|
LAZY_STREAM(VPLOG_STREAM(verbose_level), VLOG_IS_ON(verbose_level))
|
||||||
|
|
||||||
|
#define VPLOG_IF(verbose_level, condition) \
|
||||||
|
LAZY_STREAM(VPLOG_STREAM(verbose_level), \
|
||||||
|
VLOG_IS_ON(verbose_level) && (condition))
|
||||||
|
|
||||||
|
// TODO(akalin): Add more VLOG variants, e.g. VPLOG.
|
||||||
|
|
||||||
|
#define LOG_ASSERT(condition) \
|
||||||
|
LOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". "
|
||||||
|
#define SYSLOG_ASSERT(condition) \
|
||||||
|
SYSLOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". "
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
#define PLOG_STREAM(severity) \
|
||||||
|
COMPACT_GOOGLE_LOG_EX_ ## severity(Win32ErrorLogMessage, \
|
||||||
|
::cef_logging::GetLastSystemErrorCode()).stream()
|
||||||
|
#elif defined(OS_POSIX)
|
||||||
|
#define PLOG_STREAM(severity) \
|
||||||
|
COMPACT_GOOGLE_LOG_EX_ ## severity(ErrnoLogMessage, \
|
||||||
|
::cef_logging::GetLastSystemErrorCode()).stream()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PLOG(severity) \
|
||||||
|
LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity))
|
||||||
|
|
||||||
|
#define PLOG_IF(severity, condition) \
|
||||||
|
LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity) && (condition))
|
||||||
|
|
||||||
|
// The actual stream used isn't important.
|
||||||
|
#define EAT_STREAM_PARAMETERS \
|
||||||
|
true ? (void) 0 : ::cef_logging::LogMessageVoidify() & LOG_STREAM(FATAL)
|
||||||
|
|
||||||
|
// CHECK dies with a fatal error if condition is not true. It is *not*
|
||||||
|
// controlled by NDEBUG, so the check will be executed regardless of
|
||||||
|
// compilation mode.
|
||||||
|
//
|
||||||
|
// We make sure CHECK et al. always evaluates their arguments, as
|
||||||
|
// doing CHECK(FunctionWithSideEffect()) is a common idiom.
|
||||||
|
|
||||||
|
#define CHECK(condition) \
|
||||||
|
LAZY_STREAM(LOG_STREAM(FATAL), !(condition)) \
|
||||||
|
<< "Check failed: " #condition ". "
|
||||||
|
|
||||||
|
#define PCHECK(condition) \
|
||||||
|
LAZY_STREAM(PLOG_STREAM(FATAL), !(condition)) \
|
||||||
|
<< "Check failed: " #condition ". "
|
||||||
|
|
||||||
|
// Helper macro for binary operators.
|
||||||
|
// Don't use this macro directly in your code, use CHECK_EQ et al below.
|
||||||
|
//
|
||||||
|
// TODO(akalin): Rewrite this so that constructs like if (...)
|
||||||
|
// CHECK_EQ(...) else { ... } work properly.
|
||||||
|
#define CHECK_OP(name, op, val1, val2) \
|
||||||
|
if (std::string* _result = \
|
||||||
|
cef_logging::Check##name##Impl((val1), (val2), \
|
||||||
|
#val1 " " #op " " #val2)) \
|
||||||
|
cef_logging::LogMessage(__FILE__, __LINE__, _result).stream()
|
||||||
|
|
||||||
|
// Build the error message string. This is separate from the "Impl"
|
||||||
|
// function template because it is not performance critical and so can
|
||||||
|
// be out of line, while the "Impl" code should be inline. Caller
|
||||||
|
// takes ownership of the returned string.
|
||||||
|
template<class t1, class t2>
|
||||||
|
std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) {
|
||||||
|
std::ostringstream ss;
|
||||||
|
ss << names << " (" << v1 << " vs. " << v2 << ")";
|
||||||
|
std::string* msg = new std::string(ss.str());
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// MSVC doesn't like complex extern templates and DLLs.
|
||||||
|
#if !defined(COMPILER_MSVC)
|
||||||
|
// Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated
|
||||||
|
// in logging.cc.
|
||||||
|
extern template std::string* MakeCheckOpString<int, int>(
|
||||||
|
const int&, const int&, const char* names);
|
||||||
|
extern template
|
||||||
|
std::string* MakeCheckOpString<unsigned long, unsigned long>(
|
||||||
|
const unsigned long&, const unsigned long&, const char* names);
|
||||||
|
extern template
|
||||||
|
std::string* MakeCheckOpString<unsigned long, unsigned int>(
|
||||||
|
const unsigned long&, const unsigned int&, const char* names);
|
||||||
|
extern template
|
||||||
|
std::string* MakeCheckOpString<unsigned int, unsigned long>(
|
||||||
|
const unsigned int&, const unsigned long&, const char* names);
|
||||||
|
extern template
|
||||||
|
std::string* MakeCheckOpString<std::string, std::string>(
|
||||||
|
const std::string&, const std::string&, const char* name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Helper functions for CHECK_OP macro.
|
||||||
|
// The (int, int) specialization works around the issue that the compiler
|
||||||
|
// will not instantiate the template version of the function on values of
|
||||||
|
// unnamed enum type - see comment below.
|
||||||
|
#define DEFINE_CHECK_OP_IMPL(name, op) \
|
||||||
|
template <class t1, class t2> \
|
||||||
|
inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \
|
||||||
|
const char* names) { \
|
||||||
|
if (v1 op v2) return NULL; \
|
||||||
|
else return MakeCheckOpString(v1, v2, names); \
|
||||||
|
} \
|
||||||
|
inline std::string* Check##name##Impl(int v1, int v2, const char* names) { \
|
||||||
|
if (v1 op v2) return NULL; \
|
||||||
|
else return MakeCheckOpString(v1, v2, names); \
|
||||||
|
}
|
||||||
|
DEFINE_CHECK_OP_IMPL(EQ, ==)
|
||||||
|
DEFINE_CHECK_OP_IMPL(NE, !=)
|
||||||
|
DEFINE_CHECK_OP_IMPL(LE, <=)
|
||||||
|
DEFINE_CHECK_OP_IMPL(LT, < )
|
||||||
|
DEFINE_CHECK_OP_IMPL(GE, >=)
|
||||||
|
DEFINE_CHECK_OP_IMPL(GT, > )
|
||||||
|
#undef DEFINE_CHECK_OP_IMPL
|
||||||
|
|
||||||
|
#define CHECK_EQ(val1, val2) CHECK_OP(EQ, ==, val1, val2)
|
||||||
|
#define CHECK_NE(val1, val2) CHECK_OP(NE, !=, val1, val2)
|
||||||
|
#define CHECK_LE(val1, val2) CHECK_OP(LE, <=, val1, val2)
|
||||||
|
#define CHECK_LT(val1, val2) CHECK_OP(LT, < , val1, val2)
|
||||||
|
#define CHECK_GE(val1, val2) CHECK_OP(GE, >=, val1, val2)
|
||||||
|
#define CHECK_GT(val1, val2) CHECK_OP(GT, > , val1, val2)
|
||||||
|
|
||||||
|
#if defined(NDEBUG)
|
||||||
|
#define ENABLE_DLOG 0
|
||||||
|
#else
|
||||||
|
#define ENABLE_DLOG 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
|
||||||
|
#define DCHECK_IS_ON 0
|
||||||
|
#else
|
||||||
|
#define DCHECK_IS_ON 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Definitions for DLOG et al.
|
||||||
|
|
||||||
|
#if ENABLE_DLOG
|
||||||
|
|
||||||
|
#define DLOG_IS_ON(severity) LOG_IS_ON(severity)
|
||||||
|
#define DLOG_IF(severity, condition) LOG_IF(severity, condition)
|
||||||
|
#define DLOG_ASSERT(condition) LOG_ASSERT(condition)
|
||||||
|
#define DPLOG_IF(severity, condition) PLOG_IF(severity, condition)
|
||||||
|
#define DVLOG_IF(verboselevel, condition) VLOG_IF(verboselevel, condition)
|
||||||
|
#define DVPLOG_IF(verboselevel, condition) VPLOG_IF(verboselevel, condition)
|
||||||
|
|
||||||
|
#else // ENABLE_DLOG
|
||||||
|
|
||||||
|
// If ENABLE_DLOG is off, we want to avoid emitting any references to
|
||||||
|
// |condition| (which may reference a variable defined only if NDEBUG
|
||||||
|
// is not defined). Contrast this with DCHECK et al., which has
|
||||||
|
// different behavior.
|
||||||
|
|
||||||
|
#define DLOG_IS_ON(severity) false
|
||||||
|
#define DLOG_IF(severity, condition) EAT_STREAM_PARAMETERS
|
||||||
|
#define DLOG_ASSERT(condition) EAT_STREAM_PARAMETERS
|
||||||
|
#define DPLOG_IF(severity, condition) EAT_STREAM_PARAMETERS
|
||||||
|
#define DVLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
|
||||||
|
#define DVPLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
|
||||||
|
|
||||||
|
#endif // ENABLE_DLOG
|
||||||
|
|
||||||
|
// DEBUG_MODE is for uses like
|
||||||
|
// if (DEBUG_MODE) foo.CheckThatFoo();
|
||||||
|
// instead of
|
||||||
|
// #ifndef NDEBUG
|
||||||
|
// foo.CheckThatFoo();
|
||||||
|
// #endif
|
||||||
|
//
|
||||||
|
// We tie its state to ENABLE_DLOG.
|
||||||
|
enum { DEBUG_MODE = ENABLE_DLOG };
|
||||||
|
|
||||||
|
#undef ENABLE_DLOG
|
||||||
|
|
||||||
|
#define DLOG(severity) \
|
||||||
|
LAZY_STREAM(LOG_STREAM(severity), DLOG_IS_ON(severity))
|
||||||
|
|
||||||
|
#define DPLOG(severity) \
|
||||||
|
LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity))
|
||||||
|
|
||||||
|
#define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel))
|
||||||
|
|
||||||
|
#define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel))
|
||||||
|
|
||||||
|
// Definitions for DCHECK et al.
|
||||||
|
|
||||||
|
#if DCHECK_IS_ON
|
||||||
|
|
||||||
|
#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \
|
||||||
|
COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__)
|
||||||
|
#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL
|
||||||
|
const LogSeverity LOG_DCHECK = LOG_FATAL;
|
||||||
|
|
||||||
|
#else // DCHECK_IS_ON
|
||||||
|
|
||||||
|
// These are just dummy values.
|
||||||
|
#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \
|
||||||
|
COMPACT_GOOGLE_LOG_EX_INFO(ClassName , ##__VA_ARGS__)
|
||||||
|
#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_INFO
|
||||||
|
const LogSeverity LOG_DCHECK = LOG_INFO;
|
||||||
|
|
||||||
|
#endif // DCHECK_IS_ON
|
||||||
|
|
||||||
|
// DCHECK et al. make sure to reference |condition| regardless of
|
||||||
|
// whether DCHECKs are enabled; this is so that we don't get unused
|
||||||
|
// variable warnings if the only use of a variable is in a DCHECK.
|
||||||
|
// This behavior is different from DLOG_IF et al.
|
||||||
|
|
||||||
|
#define DCHECK(condition) \
|
||||||
|
LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON && !(condition)) \
|
||||||
|
<< "Check failed: " #condition ". "
|
||||||
|
|
||||||
|
#define DPCHECK(condition) \
|
||||||
|
LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON && !(condition)) \
|
||||||
|
<< "Check failed: " #condition ". "
|
||||||
|
|
||||||
|
// Helper macro for binary operators.
|
||||||
|
// Don't use this macro directly in your code, use DCHECK_EQ et al below.
|
||||||
|
#define DCHECK_OP(name, op, val1, val2) \
|
||||||
|
if (DCHECK_IS_ON) \
|
||||||
|
if (std::string* _result = \
|
||||||
|
cef_logging::Check##name##Impl((val1), (val2), \
|
||||||
|
#val1 " " #op " " #val2)) \
|
||||||
|
cef_logging::LogMessage( \
|
||||||
|
__FILE__, __LINE__, ::cef_logging::LOG_DCHECK, \
|
||||||
|
_result).stream()
|
||||||
|
|
||||||
|
// Equality/Inequality checks - compare two values, and log a
|
||||||
|
// LOG_DCHECK message including the two values when the result is not
|
||||||
|
// as expected. The values must have operator<<(ostream, ...)
|
||||||
|
// defined.
|
||||||
|
//
|
||||||
|
// You may append to the error message like so:
|
||||||
|
// DCHECK_NE(1, 2) << ": The world must be ending!";
|
||||||
|
//
|
||||||
|
// We are very careful to ensure that each argument is evaluated exactly
|
||||||
|
// once, and that anything which is legal to pass as a function argument is
|
||||||
|
// legal here. In particular, the arguments may be temporary expressions
|
||||||
|
// which will end up being destroyed at the end of the apparent statement,
|
||||||
|
// for example:
|
||||||
|
// DCHECK_EQ(string("abc")[1], 'b');
|
||||||
|
//
|
||||||
|
// WARNING: These may not compile correctly if one of the arguments is a pointer
|
||||||
|
// and the other is NULL. To work around this, simply static_cast NULL to the
|
||||||
|
// type of the desired pointer.
|
||||||
|
|
||||||
|
#define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2)
|
||||||
|
#define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2)
|
||||||
|
#define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2)
|
||||||
|
#define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2)
|
||||||
|
#define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2)
|
||||||
|
#define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2)
|
||||||
|
|
||||||
|
#if defined(NDEBUG) && defined(OS_CHROMEOS)
|
||||||
|
#define NOTREACHED() LOG(ERROR) << "NOTREACHED() hit in " << \
|
||||||
|
__FUNCTION__ << ". "
|
||||||
|
#else
|
||||||
|
#define NOTREACHED() DCHECK(false)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Redefine the standard assert to use our nice log files
|
||||||
|
#undef assert
|
||||||
|
#define assert(x) DLOG_ASSERT(x)
|
||||||
|
|
||||||
|
// This class more or less represents a particular log message. You
|
||||||
|
// create an instance of LogMessage and then stream stuff to it.
|
||||||
|
// When you finish streaming to it, ~LogMessage is called and the
|
||||||
|
// full message gets streamed to the appropriate destination.
|
||||||
|
//
|
||||||
|
// You shouldn't actually use LogMessage's constructor to log things,
|
||||||
|
// though. You should use the LOG() macro (and variants thereof)
|
||||||
|
// above.
|
||||||
|
class LogMessage {
|
||||||
|
public:
|
||||||
|
// Used for LOG(severity).
|
||||||
|
LogMessage(const char* file, int line, LogSeverity severity);
|
||||||
|
|
||||||
|
// Used for CHECK_EQ(), etc. Takes ownership of the given string.
|
||||||
|
// Implied severity = LOG_FATAL.
|
||||||
|
LogMessage(const char* file, int line, std::string* result);
|
||||||
|
|
||||||
|
// Used for DCHECK_EQ(), etc. Takes ownership of the given string.
|
||||||
|
LogMessage(const char* file, int line, LogSeverity severity,
|
||||||
|
std::string* result);
|
||||||
|
|
||||||
|
~LogMessage();
|
||||||
|
|
||||||
|
std::ostream& stream() { return stream_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
LogSeverity severity_;
|
||||||
|
std::ostringstream stream_;
|
||||||
|
|
||||||
|
// The file and line information passed in to the constructor.
|
||||||
|
const char* file_;
|
||||||
|
const int line_;
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
// Stores the current value of GetLastError in the constructor and restores
|
||||||
|
// it in the destructor by calling SetLastError.
|
||||||
|
// This is useful since the LogMessage class uses a lot of Win32 calls
|
||||||
|
// that will lose the value of GLE and the code that called the log function
|
||||||
|
// will have lost the thread error value when the log call returns.
|
||||||
|
class SaveLastError {
|
||||||
|
public:
|
||||||
|
SaveLastError();
|
||||||
|
~SaveLastError();
|
||||||
|
|
||||||
|
unsigned long get_error() const { return last_error_; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
unsigned long last_error_;
|
||||||
|
};
|
||||||
|
|
||||||
|
SaveLastError last_error_;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(LogMessage);
|
||||||
|
};
|
||||||
|
|
||||||
|
// A non-macro interface to the log facility; (useful
|
||||||
|
// when the logging level is not a compile-time constant).
|
||||||
|
inline void LogAtLevel(int const log_level, std::string const &msg) {
|
||||||
|
LogMessage(__FILE__, __LINE__, log_level).stream() << msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This class is used to explicitly ignore values in the conditional
|
||||||
|
// logging macros. This avoids compiler warnings like "value computed
|
||||||
|
// is not used" and "statement has no effect".
|
||||||
|
class LogMessageVoidify {
|
||||||
|
public:
|
||||||
|
LogMessageVoidify() { }
|
||||||
|
// This has to be an operator with a precedence lower than << but
|
||||||
|
// higher than ?:
|
||||||
|
void operator&(std::ostream&) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
typedef unsigned long SystemErrorCode;
|
||||||
|
#elif defined(OS_POSIX)
|
||||||
|
typedef int SystemErrorCode;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Alias for ::GetLastError() on Windows and errno on POSIX. Avoids having to
|
||||||
|
// pull in windows.h just for GetLastError() and DWORD.
|
||||||
|
SystemErrorCode GetLastSystemErrorCode();
|
||||||
|
std::string SystemErrorCodeToString(SystemErrorCode error_code);
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
// Appends a formatted system message of the GetLastError() type.
|
||||||
|
class Win32ErrorLogMessage {
|
||||||
|
public:
|
||||||
|
Win32ErrorLogMessage(const char* file,
|
||||||
|
int line,
|
||||||
|
LogSeverity severity,
|
||||||
|
SystemErrorCode err);
|
||||||
|
|
||||||
|
// Appends the error message before destructing the encapsulated class.
|
||||||
|
~Win32ErrorLogMessage();
|
||||||
|
|
||||||
|
std::ostream& stream() { return log_message_.stream(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
SystemErrorCode err_;
|
||||||
|
LogMessage log_message_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(Win32ErrorLogMessage);
|
||||||
|
};
|
||||||
|
#elif defined(OS_POSIX)
|
||||||
|
// Appends a formatted system message of the errno type
|
||||||
|
class ErrnoLogMessage {
|
||||||
|
public:
|
||||||
|
ErrnoLogMessage(const char* file,
|
||||||
|
int line,
|
||||||
|
LogSeverity severity,
|
||||||
|
SystemErrorCode err);
|
||||||
|
|
||||||
|
// Appends the error message before destructing the encapsulated class.
|
||||||
|
~ErrnoLogMessage();
|
||||||
|
|
||||||
|
std::ostream& stream() { return log_message_.stream(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
SystemErrorCode err_;
|
||||||
|
LogMessage log_message_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(ErrnoLogMessage);
|
||||||
|
};
|
||||||
|
#endif // OS_WIN
|
||||||
|
|
||||||
|
} // namespace cef_logging
|
||||||
|
|
||||||
|
// These functions are provided as a convenience for logging, which is where we
|
||||||
|
// use streams (it is against Google style to use streams in other places). It
|
||||||
|
// is designed to allow you to emit non-ASCII Unicode strings to the log file,
|
||||||
|
// which is normally ASCII. It is relatively slow, so try not to use it for
|
||||||
|
// common cases. Non-ASCII characters will be converted to UTF-8 by these
|
||||||
|
// operators.
|
||||||
|
std::ostream& operator<<(std::ostream& out, const wchar_t* wstr);
|
||||||
|
inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
|
||||||
|
return out << wstr.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
// The NOTIMPLEMENTED() macro annotates codepaths which have
|
||||||
|
// not been implemented yet.
|
||||||
|
//
|
||||||
|
// The implementation of this macro is controlled by NOTIMPLEMENTED_POLICY:
|
||||||
|
// 0 -- Do nothing (stripped by compiler)
|
||||||
|
// 1 -- Warn at compile time
|
||||||
|
// 2 -- Fail at compile time
|
||||||
|
// 3 -- Fail at runtime (DCHECK)
|
||||||
|
// 4 -- [default] LOG(ERROR) at runtime
|
||||||
|
// 5 -- LOG(ERROR) at runtime, only once per call-site
|
||||||
|
|
||||||
|
#ifndef NOTIMPLEMENTED_POLICY
|
||||||
|
#if defined(OS_ANDROID) && defined(OFFICIAL_BUILD)
|
||||||
|
#define NOTIMPLEMENTED_POLICY 0
|
||||||
|
#else
|
||||||
|
// Select default policy: LOG(ERROR)
|
||||||
|
#define NOTIMPLEMENTED_POLICY 4
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(COMPILER_GCC)
|
||||||
|
// On Linux, with GCC, we can use __PRETTY_FUNCTION__ to get the demangled name
|
||||||
|
// of the current function in the NOTIMPLEMENTED message.
|
||||||
|
#define NOTIMPLEMENTED_MSG "Not implemented reached in " << __PRETTY_FUNCTION__
|
||||||
|
#else
|
||||||
|
#define NOTIMPLEMENTED_MSG "NOT IMPLEMENTED"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if NOTIMPLEMENTED_POLICY == 0
|
||||||
|
#define NOTIMPLEMENTED() EAT_STREAM_PARAMETERS
|
||||||
|
#elif NOTIMPLEMENTED_POLICY == 1
|
||||||
|
// TODO, figure out how to generate a warning
|
||||||
|
#define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED)
|
||||||
|
#elif NOTIMPLEMENTED_POLICY == 2
|
||||||
|
#define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED)
|
||||||
|
#elif NOTIMPLEMENTED_POLICY == 3
|
||||||
|
#define NOTIMPLEMENTED() NOTREACHED()
|
||||||
|
#elif NOTIMPLEMENTED_POLICY == 4
|
||||||
|
#define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG
|
||||||
|
#elif NOTIMPLEMENTED_POLICY == 5
|
||||||
|
#define NOTIMPLEMENTED() do {\
|
||||||
|
static bool logged_once = false;\
|
||||||
|
LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
|
||||||
|
logged_once = true;\
|
||||||
|
} while(0);\
|
||||||
|
EAT_STREAM_PARAMETERS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // !BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_BASE_CEF_LOGGING_H_
|
123
include/base/cef_macros.h
Normal file
123
include/base/cef_macros.h
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
|
||||||
|
// Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||||
|
// Framework nor the names of its contributors may be used to endorse
|
||||||
|
// or promote products derived from this software without specific prior
|
||||||
|
// written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#ifndef CEF_INCLUDE_BASE_CEF_MACROS_H_
|
||||||
|
#define CEF_INCLUDE_BASE_CEF_MACROS_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if defined(BUILDING_CEF_SHARED)
|
||||||
|
// When building CEF include the Chromium header directly.
|
||||||
|
#include "base/macros.h"
|
||||||
|
#else // !BUILDING_CEF_SHARED
|
||||||
|
// The following is substantially similar to the Chromium implementation.
|
||||||
|
// If the Chromium implementation diverges the below implementation should be
|
||||||
|
// updated to match.
|
||||||
|
|
||||||
|
#include <stddef.h> // For size_t.
|
||||||
|
|
||||||
|
#if !defined(ALLOW_THIS_IN_INITIALIZER_LIST)
|
||||||
|
#if defined(COMPILER_MSVC)
|
||||||
|
|
||||||
|
// MSVC_PUSH_DISABLE_WARNING pushes |n| onto a stack of warnings to be disabled.
|
||||||
|
// The warning remains disabled until popped by MSVC_POP_WARNING.
|
||||||
|
#define MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \
|
||||||
|
__pragma(warning(disable:n))
|
||||||
|
|
||||||
|
// MSVC_PUSH_WARNING_LEVEL pushes |n| as the global warning level. The level
|
||||||
|
// remains in effect until popped by MSVC_POP_WARNING(). Use 0 to disable all
|
||||||
|
// warnings.
|
||||||
|
#define MSVC_PUSH_WARNING_LEVEL(n) __pragma(warning(push, n))
|
||||||
|
|
||||||
|
// Pop effects of innermost MSVC_PUSH_* macro.
|
||||||
|
#define MSVC_POP_WARNING() __pragma(warning(pop))
|
||||||
|
|
||||||
|
// Allows |this| to be passed as an argument in constructor initializer lists.
|
||||||
|
// This uses push/pop instead of the seemingly simpler suppress feature to avoid
|
||||||
|
// having the warning be disabled for more than just |code|.
|
||||||
|
//
|
||||||
|
// Example usage:
|
||||||
|
// Foo::Foo() : x(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(y(this)), z(3) {}
|
||||||
|
//
|
||||||
|
// Compiler warning C4355: 'this': used in base member initializer list:
|
||||||
|
// http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx
|
||||||
|
#define ALLOW_THIS_IN_INITIALIZER_LIST(code) MSVC_PUSH_DISABLE_WARNING(4355) \
|
||||||
|
code \
|
||||||
|
MSVC_POP_WARNING()
|
||||||
|
#else // !COMPILER_MSVC
|
||||||
|
|
||||||
|
#define ALLOW_THIS_IN_INITIALIZER_LIST(code) code
|
||||||
|
|
||||||
|
#endif // !COMPILER_MSVC
|
||||||
|
#endif // !ALLOW_THIS_IN_INITIALIZER_LIST
|
||||||
|
|
||||||
|
#if !defined(arraysize)
|
||||||
|
|
||||||
|
// The arraysize(arr) macro returns the # of elements in an array arr.
|
||||||
|
// The expression is a compile-time constant, and therefore can be
|
||||||
|
// used in defining new arrays, for example. If you use arraysize on
|
||||||
|
// a pointer by mistake, you will get a compile-time error.
|
||||||
|
//
|
||||||
|
// One caveat is that arraysize() doesn't accept any array of an
|
||||||
|
// anonymous type or a type defined inside a function. In these rare
|
||||||
|
// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is
|
||||||
|
// due to a limitation in C++'s template system. The limitation might
|
||||||
|
// eventually be removed, but it hasn't happened yet.
|
||||||
|
|
||||||
|
// This template function declaration is used in defining arraysize.
|
||||||
|
// Note that the function doesn't need an implementation, as we only
|
||||||
|
// use its type.
|
||||||
|
template <typename T, size_t N>
|
||||||
|
char (&ArraySizeHelper(T (&array)[N]))[N];
|
||||||
|
|
||||||
|
// That gcc wants both of these prototypes seems mysterious. VC, for
|
||||||
|
// its part, can't decide which to use (another mystery). Matching of
|
||||||
|
// template overloads: the final frontier.
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
template <typename T, size_t N>
|
||||||
|
char (&ArraySizeHelper(const T (&array)[N]))[N];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
|
||||||
|
|
||||||
|
#endif // !arraysize
|
||||||
|
|
||||||
|
#if !defined(DISALLOW_COPY_AND_ASSIGN)
|
||||||
|
|
||||||
|
// A macro to disallow the copy constructor and operator= functions
|
||||||
|
// This should be used in the private: declarations for a class
|
||||||
|
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||||
|
TypeName(const TypeName&); \
|
||||||
|
void operator=(const TypeName&)
|
||||||
|
|
||||||
|
#endif // !DISALLOW_COPY_AND_ASSIGN
|
||||||
|
|
||||||
|
#endif // !BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_BASE_CEF_MACROS_H_
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2012 Marshall A. Greenblatt. Portions copyright (c) 2012
|
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
|
||||||
// Google Inc. All rights reserved.
|
// Google Inc. All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
@ -36,12 +36,12 @@
|
|||||||
//
|
//
|
||||||
// Events are issued against categories. Whereas LOG's categories are statically
|
// Events are issued against categories. Whereas LOG's categories are statically
|
||||||
// defined, TRACE categories are created implicitly with a string. For example:
|
// defined, TRACE categories are created implicitly with a string. For example:
|
||||||
// CEF_TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent")
|
// TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent")
|
||||||
//
|
//
|
||||||
// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope:
|
// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope:
|
||||||
// CEF_TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly")
|
// TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly")
|
||||||
// doSomethingCostly()
|
// doSomethingCostly()
|
||||||
// CEF_TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly")
|
// TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly")
|
||||||
// Note: Our tools can't always determine the correct BEGIN/END pairs unless
|
// Note: Our tools can't always determine the correct BEGIN/END pairs unless
|
||||||
// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you
|
// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you
|
||||||
// need them to be in separate scopes.
|
// need them to be in separate scopes.
|
||||||
@ -49,13 +49,13 @@
|
|||||||
// A common use case is to trace entire function scopes. This issues a trace
|
// A common use case is to trace entire function scopes. This issues a trace
|
||||||
// BEGIN and END automatically:
|
// BEGIN and END automatically:
|
||||||
// void doSomethingCostly() {
|
// void doSomethingCostly() {
|
||||||
// CEF_TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly");
|
// TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly");
|
||||||
// ...
|
// ...
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// Additional parameters can be associated with an event:
|
// Additional parameters can be associated with an event:
|
||||||
// void doSomethingCostly2(int howMuch) {
|
// void doSomethingCostly2(int howMuch) {
|
||||||
// CEF_TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly",
|
// TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly",
|
||||||
// "howMuch", howMuch);
|
// "howMuch", howMuch);
|
||||||
// ...
|
// ...
|
||||||
// }
|
// }
|
||||||
@ -68,11 +68,11 @@
|
|||||||
// [single threaded sender code]
|
// [single threaded sender code]
|
||||||
// static int send_count = 0;
|
// static int send_count = 0;
|
||||||
// ++send_count;
|
// ++send_count;
|
||||||
// CEF_TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count);
|
// TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count);
|
||||||
// Send(new MyMessage(send_count));
|
// Send(new MyMessage(send_count));
|
||||||
// [receive code]
|
// [receive code]
|
||||||
// void OnMyMessage(send_count) {
|
// void OnMyMessage(send_count) {
|
||||||
// CEF_TRACE_EVENT_ASYNC_END0("ipc", "message", send_count);
|
// TRACE_EVENT_ASYNC_END0("ipc", "message", send_count);
|
||||||
// }
|
// }
|
||||||
// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs.
|
// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs.
|
||||||
// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process.
|
// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process.
|
||||||
@ -82,33 +82,33 @@
|
|||||||
// class MyTracedClass {
|
// class MyTracedClass {
|
||||||
// public:
|
// public:
|
||||||
// MyTracedClass() {
|
// MyTracedClass() {
|
||||||
// CEF_TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this);
|
// TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this);
|
||||||
// }
|
// }
|
||||||
// ~MyTracedClass() {
|
// ~MyTracedClass() {
|
||||||
// CEF_TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this);
|
// TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// The trace event also supports counters, which is a way to track a quantity
|
// The trace event also supports counters, which is a way to track a quantity
|
||||||
// as it varies over time. Counters are created with the following macro:
|
// as it varies over time. Counters are created with the following macro:
|
||||||
// CEF_TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue);
|
// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue);
|
||||||
//
|
//
|
||||||
// Counters are process-specific. The macro itself can be issued from any
|
// Counters are process-specific. The macro itself can be issued from any
|
||||||
// thread, however.
|
// thread, however.
|
||||||
//
|
//
|
||||||
// Sometimes, you want to track two counters at once. You can do this with two
|
// Sometimes, you want to track two counters at once. You can do this with two
|
||||||
// counter macros:
|
// counter macros:
|
||||||
// CEF_TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]);
|
// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]);
|
||||||
// CEF_TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]);
|
// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]);
|
||||||
// Or you can do it with a combined macro:
|
// Or you can do it with a combined macro:
|
||||||
// CEF_TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter",
|
// TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter",
|
||||||
// "bytesPinned", g_myCounterValue[0],
|
// "bytesPinned", g_myCounterValue[0],
|
||||||
// "bytesAllocated", g_myCounterValue[1]);
|
// "bytesAllocated", g_myCounterValue[1]);
|
||||||
// This indicates to the tracing UI that these counters should be displayed
|
// This indicates to the tracing UI that these counters should be displayed
|
||||||
// in a single graph, as a summed area chart.
|
// in a single graph, as a summed area chart.
|
||||||
//
|
//
|
||||||
// Since counters are in a global namespace, you may want to disembiguate with a
|
// Since counters are in a global namespace, you may want to disembiguate with a
|
||||||
// unique ID, by using the CEF_TRACE_COUNTER_ID* variations.
|
// unique ID, by using the TRACE_COUNTER_ID* variations.
|
||||||
//
|
//
|
||||||
// By default, trace collection is compiled in, but turned off at runtime.
|
// By default, trace collection is compiled in, but turned off at runtime.
|
||||||
// Collecting trace data is the responsibility of the embedding application. In
|
// Collecting trace data is the responsibility of the embedding application. In
|
||||||
@ -121,11 +121,11 @@
|
|||||||
// in for category, name, and arg_names. Thus, the following code will cause
|
// in for category, name, and arg_names. Thus, the following code will cause
|
||||||
// problems:
|
// problems:
|
||||||
// char* str = strdup("impprtantName");
|
// char* str = strdup("impprtantName");
|
||||||
// CEF_TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD!
|
// TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD!
|
||||||
// free(str); // Trace system now has dangling pointer
|
// free(str); // Trace system now has dangling pointer
|
||||||
//
|
//
|
||||||
// To avoid this issue with the |name| and |arg_name| parameters, use the
|
// To avoid this issue with the |name| and |arg_name| parameters, use the
|
||||||
// CEF_TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime
|
// TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime
|
||||||
// overhead.
|
// overhead.
|
||||||
// Notes: The category must always be in a long-lived char* (i.e. static const).
|
// Notes: The category must always be in a long-lived char* (i.e. static const).
|
||||||
// The |arg_values|, when used, are always deep copied with the _COPY
|
// The |arg_values|, when used, are always deep copied with the _COPY
|
||||||
@ -136,110 +136,37 @@
|
|||||||
// All macros are thread safe and can be used from any process.
|
// All macros are thread safe and can be used from any process.
|
||||||
///
|
///
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CEF_TRACE_EVENT_H_
|
#ifndef CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_
|
||||||
#define CEF_INCLUDE_CEF_TRACE_EVENT_H_
|
#define CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/internal/cef_export.h"
|
#if defined(TRACE_EVENT0)
|
||||||
#include "include/internal/cef_types.h"
|
// Do nothing if the macros provided by this header already exist.
|
||||||
|
// This can happen in cases where Chromium code is used directly by the
|
||||||
|
// client application. When using Chromium code directly always include
|
||||||
|
// the Chromium header first to avoid type conflicts.
|
||||||
|
#elif defined(BUILDING_CEF_SHARED)
|
||||||
|
// When building CEF include the Chromium header directly.
|
||||||
|
#include "base/debug/trace_event.h"
|
||||||
|
#else // !BUILDING_CEF_SHARED
|
||||||
|
// The following is substantially similar to the Chromium implementation.
|
||||||
|
// If the Chromium implementation diverges the below implementation should be
|
||||||
|
// updated to match.
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#include "include/internal/cef_trace_event_internal.h"
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Functions for tracing counters and functions; called from macros.
|
|
||||||
// - |category| string must have application lifetime (static or literal). They
|
|
||||||
// may not include "(quotes) chars.
|
|
||||||
// - |argX_name|, |argX_val|, |valueX_name|, |valeX_val| are optional parameters
|
|
||||||
// and represent pairs of name and values of arguments
|
|
||||||
// - |copy| is used to avoid memory scoping issues with the |name| and
|
|
||||||
// |arg_name| parameters by copying them
|
|
||||||
// - |id| is used to disambiguate counters with the same name, or match async
|
|
||||||
// trace events
|
|
||||||
|
|
||||||
CEF_EXPORT void cef_trace_event_instant(const char* category,
|
|
||||||
const char* name,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
const char* arg2_name,
|
|
||||||
uint64 arg2_val,
|
|
||||||
int copy);
|
|
||||||
CEF_EXPORT void cef_trace_event_begin(const char* category,
|
|
||||||
const char* name,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
const char* arg2_name,
|
|
||||||
uint64 arg2_val,
|
|
||||||
int copy);
|
|
||||||
CEF_EXPORT void cef_trace_event_end(const char* category,
|
|
||||||
const char* name,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
const char* arg2_name,
|
|
||||||
uint64 arg2_val,
|
|
||||||
int copy);
|
|
||||||
CEF_EXPORT void cef_trace_counter(const char* category,
|
|
||||||
const char* name,
|
|
||||||
const char* value1_name,
|
|
||||||
uint64 value1_val,
|
|
||||||
const char* value2_name,
|
|
||||||
uint64 value2_val,
|
|
||||||
int copy);
|
|
||||||
CEF_EXPORT void cef_trace_counter_id(const char* category,
|
|
||||||
const char* name,
|
|
||||||
uint64 id,
|
|
||||||
const char* value1_name,
|
|
||||||
uint64 value1_val,
|
|
||||||
const char* value2_name,
|
|
||||||
uint64 value2_val,
|
|
||||||
int copy);
|
|
||||||
CEF_EXPORT void cef_trace_event_async_begin(const char* category,
|
|
||||||
const char* name,
|
|
||||||
uint64 id,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
const char* arg2_name,
|
|
||||||
uint64 arg2_val,
|
|
||||||
int copy);
|
|
||||||
CEF_EXPORT void cef_trace_event_async_step_into(const char* category,
|
|
||||||
const char* name,
|
|
||||||
uint64 id,
|
|
||||||
uint64 step,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
int copy);
|
|
||||||
CEF_EXPORT void cef_trace_event_async_step_past(const char* category,
|
|
||||||
const char* name,
|
|
||||||
uint64 id,
|
|
||||||
uint64 step,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
int copy);
|
|
||||||
CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|
||||||
const char* name,
|
|
||||||
uint64 id,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
const char* arg2_name,
|
|
||||||
uint64 arg2_val,
|
|
||||||
int copy);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Records a pair of begin and end events called "name" for the current
|
// Records a pair of begin and end events called "name" for the current
|
||||||
// scope, with 0, 1 or 2 associated arguments. If the category is not
|
// scope, with 0, 1 or 2 associated arguments. If the category is not
|
||||||
// enabled, then this does nothing.
|
// enabled, then this does nothing.
|
||||||
// - category and name strings must have application lifetime (statics or
|
// - category and name strings must have application lifetime (statics or
|
||||||
// literals). They may not include " chars.
|
// literals). They may not include " chars.
|
||||||
#define CEF_TRACE_EVENT0(category, name) \
|
#define TRACE_EVENT0(category, name) \
|
||||||
cef_trace_event_begin(category, name, NULL, 0, NULL, 0, false); \
|
cef_trace_event_begin(category, name, NULL, 0, NULL, 0, false); \
|
||||||
CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
|
CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
|
||||||
#define CEF_TRACE_EVENT1(category, name, arg1_name, arg1_val) \
|
#define TRACE_EVENT1(category, name, arg1_name, arg1_val) \
|
||||||
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, false); \
|
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, false); \
|
||||||
CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
|
CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
|
||||||
#define CEF_TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, \
|
#define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, \
|
||||||
arg2_val) \
|
arg2_val) \
|
||||||
cef_trace_event_begin(category, name, arg1_name, arg1_val, \
|
cef_trace_event_begin(category, name, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val, false); \
|
arg2_name, arg2_val, false); \
|
||||||
@ -257,7 +184,7 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
|
|
||||||
// Implementation detail: internal macro to end end event when the scope ends.
|
// Implementation detail: internal macro to end end event when the scope ends.
|
||||||
#define CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name) \
|
#define CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name) \
|
||||||
cef_trace_event_internal::CefTraceEndOnScopeClose \
|
cef_trace_event::CefTraceEndOnScopeClose \
|
||||||
CEF_INTERNAL_TRACE_EVENT_UID(profileScope)(category, name)
|
CEF_INTERNAL_TRACE_EVENT_UID(profileScope)(category, name)
|
||||||
|
|
||||||
// Records a single event called "name" immediately, with 0, 1 or 2
|
// Records a single event called "name" immediately, with 0, 1 or 2
|
||||||
@ -265,19 +192,19 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
// does nothing.
|
// does nothing.
|
||||||
// - category and name strings must have application lifetime (statics or
|
// - category and name strings must have application lifetime (statics or
|
||||||
// literals). They may not include " chars.
|
// literals). They may not include " chars.
|
||||||
#define CEF_TRACE_EVENT_INSTANT0(category, name) \
|
#define TRACE_EVENT_INSTANT0(category, name) \
|
||||||
cef_trace_event_instant(category, name, NULL, 0, NULL, 0, false)
|
cef_trace_event_instant(category, name, NULL, 0, NULL, 0, false)
|
||||||
#define CEF_TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
|
#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
|
||||||
cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0, false)
|
cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0, false)
|
||||||
#define CEF_TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \
|
#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val) \
|
arg2_name, arg2_val) \
|
||||||
cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \
|
cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \
|
||||||
arg2_val, false)
|
arg2_val, false)
|
||||||
#define CEF_TRACE_EVENT_COPY_INSTANT0(category, name) \
|
#define TRACE_EVENT_COPY_INSTANT0(category, name) \
|
||||||
cef_trace_event_instant(category, name, NULL, 0, NULL, 0, true)
|
cef_trace_event_instant(category, name, NULL, 0, NULL, 0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_INSTANT1(category, name, arg1_name, arg1_val) \
|
#define TRACE_EVENT_COPY_INSTANT1(category, name, arg1_name, arg1_val) \
|
||||||
cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0, true)
|
cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_INSTANT2(category, name, arg1_name, arg1_val, \
|
#define TRACE_EVENT_COPY_INSTANT2(category, name, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val) \
|
arg2_name, arg2_val) \
|
||||||
cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \
|
cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \
|
||||||
arg2_val, true)
|
arg2_val, true)
|
||||||
@ -287,19 +214,19 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
// does nothing.
|
// does nothing.
|
||||||
// - category and name strings must have application lifetime (statics or
|
// - category and name strings must have application lifetime (statics or
|
||||||
// literals). They may not include " chars.
|
// literals). They may not include " chars.
|
||||||
#define CEF_TRACE_EVENT_BEGIN0(category, name) \
|
#define TRACE_EVENT_BEGIN0(category, name) \
|
||||||
cef_trace_event_begin(category, name, NULL, 0, NULL, 0, false)
|
cef_trace_event_begin(category, name, NULL, 0, NULL, 0, false)
|
||||||
#define CEF_TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val) \
|
#define TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val) \
|
||||||
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, false)
|
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, false)
|
||||||
#define CEF_TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val, \
|
#define TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val) \
|
arg2_name, arg2_val) \
|
||||||
cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
|
cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
|
||||||
arg2_val, false)
|
arg2_val, false)
|
||||||
#define CEF_TRACE_EVENT_COPY_BEGIN0(category, name) \
|
#define TRACE_EVENT_COPY_BEGIN0(category, name) \
|
||||||
cef_trace_event_begin(category, name, NULL, 0, NULL, 0, true)
|
cef_trace_event_begin(category, name, NULL, 0, NULL, 0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val) \
|
#define TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val) \
|
||||||
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, true)
|
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val, \
|
#define TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val) \
|
arg2_name, arg2_val) \
|
||||||
cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
|
cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
|
||||||
arg2_val, true)
|
arg2_val, true)
|
||||||
@ -308,19 +235,19 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
// is not enabled, then this does nothing.
|
// is not enabled, then this does nothing.
|
||||||
// - category and name strings must have application lifetime (statics or
|
// - category and name strings must have application lifetime (statics or
|
||||||
// literals). They may not include " chars.
|
// literals). They may not include " chars.
|
||||||
#define CEF_TRACE_EVENT_END0(category, name) \
|
#define TRACE_EVENT_END0(category, name) \
|
||||||
cef_trace_event_end(category, name, NULL, 0, NULL, 0, false)
|
cef_trace_event_end(category, name, NULL, 0, NULL, 0, false)
|
||||||
#define CEF_TRACE_EVENT_END1(category, name, arg1_name, arg1_val) \
|
#define TRACE_EVENT_END1(category, name, arg1_name, arg1_val) \
|
||||||
cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0, false)
|
cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0, false)
|
||||||
#define CEF_TRACE_EVENT_END2(category, name, arg1_name, arg1_val, \
|
#define TRACE_EVENT_END2(category, name, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val) \
|
arg2_name, arg2_val) \
|
||||||
cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, \
|
cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, \
|
||||||
arg2_val, false)
|
arg2_val, false)
|
||||||
#define CEF_TRACE_EVENT_COPY_END0(category, name) \
|
#define TRACE_EVENT_COPY_END0(category, name) \
|
||||||
cef_trace_event_end(category, name, NULL, 0, NULL, 0, true)
|
cef_trace_event_end(category, name, NULL, 0, NULL, 0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val) \
|
#define TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val) \
|
||||||
cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0, true)
|
cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val, \
|
#define TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val) \
|
arg2_name, arg2_val) \
|
||||||
cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, \
|
cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, \
|
||||||
arg2_val, true)
|
arg2_val, true)
|
||||||
@ -329,9 +256,9 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
// must be representable as a 32 bit integer.
|
// must be representable as a 32 bit integer.
|
||||||
// - category and name strings must have application lifetime (statics or
|
// - category and name strings must have application lifetime (statics or
|
||||||
// literals). They may not include " chars.
|
// literals). They may not include " chars.
|
||||||
#define CEF_TRACE_COUNTER1(category, name, value) \
|
#define TRACE_COUNTER1(category, name, value) \
|
||||||
cef_trace_counter(category, name, NULL, value, NULL, 0, false)
|
cef_trace_counter(category, name, NULL, value, NULL, 0, false)
|
||||||
#define CEF_TRACE_COPY_COUNTER1(category, name, value) \
|
#define TRACE_COPY_COUNTER1(category, name, value) \
|
||||||
cef_trace_counter(category, name, NULL, value, NULL, 0, true)
|
cef_trace_counter(category, name, NULL, value, NULL, 0, true)
|
||||||
|
|
||||||
// Records the values of a multi-parted counter called "name" immediately.
|
// Records the values of a multi-parted counter called "name" immediately.
|
||||||
@ -339,11 +266,11 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
// values as a stacked-bar chart.
|
// values as a stacked-bar chart.
|
||||||
// - category and name strings must have application lifetime (statics or
|
// - category and name strings must have application lifetime (statics or
|
||||||
// literals). They may not include " chars.
|
// literals). They may not include " chars.
|
||||||
#define CEF_TRACE_COUNTER2(category, name, value1_name, value1_val, \
|
#define TRACE_COUNTER2(category, name, value1_name, value1_val, \
|
||||||
value2_name, value2_val) \
|
value2_name, value2_val) \
|
||||||
cef_trace_counter(category, name, value1_name, value1_val, value2_name, \
|
cef_trace_counter(category, name, value1_name, value1_val, value2_name, \
|
||||||
value2_val, false)
|
value2_val, false)
|
||||||
#define CEF_TRACE_COPY_COUNTER2(category, name, value1_name, value1_val, \
|
#define TRACE_COPY_COUNTER2(category, name, value1_name, value1_val, \
|
||||||
value2_name, value2_val) \
|
value2_name, value2_val) \
|
||||||
cef_trace_counter(category, name, value1_name, value1_val, value2_name, \
|
cef_trace_counter(category, name, value1_name, value1_val, value2_name, \
|
||||||
value2_val, true)
|
value2_val, true)
|
||||||
@ -356,9 +283,9 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
// be a pointer or an integer value up to 64 bits. If it's a pointer, the
|
// be a pointer or an integer value up to 64 bits. If it's a pointer, the
|
||||||
// bits will be xored with a hash of the process ID so that the same pointer
|
// bits will be xored with a hash of the process ID so that the same pointer
|
||||||
// on two different processes will not collide.
|
// on two different processes will not collide.
|
||||||
#define CEF_TRACE_COUNTER_ID1(category, name, id, value) \
|
#define TRACE_COUNTER_ID1(category, name, id, value) \
|
||||||
cef_trace_counter_id(category, name, id, NULL, value, NULL, 0, false)
|
cef_trace_counter_id(category, name, id, NULL, value, NULL, 0, false)
|
||||||
#define CEF_TRACE_COPY_COUNTER_ID1(category, name, id, value) \
|
#define TRACE_COPY_COUNTER_ID1(category, name, id, value) \
|
||||||
cef_trace_counter_id(category, name, id, NULL, value, NULL, 0, true)
|
cef_trace_counter_id(category, name, id, NULL, value, NULL, 0, true)
|
||||||
|
|
||||||
// Records the values of a multi-parted counter called "name" immediately.
|
// Records the values of a multi-parted counter called "name" immediately.
|
||||||
@ -370,11 +297,11 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
// be a pointer or an integer value up to 64 bits. If it's a pointer, the
|
// be a pointer or an integer value up to 64 bits. If it's a pointer, the
|
||||||
// bits will be xored with a hash of the process ID so that the same pointer
|
// bits will be xored with a hash of the process ID so that the same pointer
|
||||||
// on two different processes will not collide.
|
// on two different processes will not collide.
|
||||||
#define CEF_TRACE_COUNTER_ID2(category, name, id, value1_name, value1_val, \
|
#define TRACE_COUNTER_ID2(category, name, id, value1_name, value1_val, \
|
||||||
value2_name, value2_val) \
|
value2_name, value2_val) \
|
||||||
cef_trace_counter_id(category, name, id, value1_name, value1_val, \
|
cef_trace_counter_id(category, name, id, value1_name, value1_val, \
|
||||||
value2_name, value2_val, false)
|
value2_name, value2_val, false)
|
||||||
#define CEF_TRACE_COPY_COUNTER_ID2(category, name, id, value1_name, \
|
#define TRACE_COPY_COUNTER_ID2(category, name, id, value1_name, \
|
||||||
value1_val, value2_name, value2_val) \
|
value1_val, value2_name, value2_val) \
|
||||||
cef_trace_counter_id(category, name, id, value1_name, value1_val, \
|
cef_trace_counter_id(category, name, id, value1_name, value1_val, \
|
||||||
value2_name, value2_val, true)
|
value2_name, value2_val, true)
|
||||||
@ -396,22 +323,22 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
// An async operation can span threads and processes, but all events in that
|
// An async operation can span threads and processes, but all events in that
|
||||||
// operation must use the same |name| and |id|. Each event can have its own
|
// operation must use the same |name| and |id|. Each event can have its own
|
||||||
// args.
|
// args.
|
||||||
#define CEF_TRACE_EVENT_ASYNC_BEGIN0(category, name, id) \
|
#define TRACE_EVENT_ASYNC_BEGIN0(category, name, id) \
|
||||||
cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0, false)
|
cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0, false)
|
||||||
#define CEF_TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
|
#define TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
|
||||||
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, \
|
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, \
|
||||||
0, false)
|
0, false)
|
||||||
#define CEF_TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
|
#define TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val) \
|
arg2_name, arg2_val) \
|
||||||
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \
|
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val, false)
|
arg2_name, arg2_val, false)
|
||||||
#define CEF_TRACE_EVENT_COPY_ASYNC_BEGIN0(category, name, id) \
|
#define TRACE_EVENT_COPY_ASYNC_BEGIN0(category, name, id) \
|
||||||
cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0, true)
|
cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_ASYNC_BEGIN1(category, name, id, arg1_name, \
|
#define TRACE_EVENT_COPY_ASYNC_BEGIN1(category, name, id, arg1_name, \
|
||||||
arg1_val) \
|
arg1_val) \
|
||||||
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, \
|
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, \
|
||||||
0, true)
|
0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_ASYNC_BEGIN2(category, name, id, arg1_name, \
|
#define TRACE_EVENT_COPY_ASYNC_BEGIN2(category, name, id, arg1_name, \
|
||||||
arg1_val, arg2_name, arg2_val) \
|
arg1_val, arg2_name, arg2_val) \
|
||||||
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \
|
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val, true)
|
arg2_name, arg2_val, true)
|
||||||
@ -422,15 +349,15 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
// within the async event. This should be called at the beginning of the next
|
// within the async event. This should be called at the beginning of the next
|
||||||
// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
|
// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
|
||||||
// ASYNC_STEP_PAST events.
|
// ASYNC_STEP_PAST events.
|
||||||
#define CEF_TRACE_EVENT_ASYNC_STEP_INTO0(category, name, id, step) \
|
#define TRACE_EVENT_ASYNC_STEP_INTO0(category, name, id, step) \
|
||||||
cef_trace_event_async_step_into(category, name, id, step, NULL, 0, false)
|
cef_trace_event_async_step_into(category, name, id, step, NULL, 0, false)
|
||||||
#define CEF_TRACE_EVENT_ASYNC_STEP_INTO1(category, name, id, step, \
|
#define TRACE_EVENT_ASYNC_STEP_INTO1(category, name, id, step, \
|
||||||
arg1_name, arg1_val) \
|
arg1_name, arg1_val) \
|
||||||
cef_trace_event_async_step_into(category, name, id, step, arg1_name, \
|
cef_trace_event_async_step_into(category, name, id, step, arg1_name, \
|
||||||
arg1_val, false)
|
arg1_val, false)
|
||||||
#define CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO0(category, name, id, step) \
|
#define TRACE_EVENT_COPY_ASYNC_STEP_INTO0(category, name, id, step) \
|
||||||
cef_trace_event_async_step_into(category, name, id, step, NULL, 0, true)
|
cef_trace_event_async_step_into(category, name, id, step, NULL, 0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO1(category, name, id, step, \
|
#define TRACE_EVENT_COPY_ASYNC_STEP_INTO1(category, name, id, step, \
|
||||||
arg1_name, arg1_val) \
|
arg1_name, arg1_val) \
|
||||||
cef_trace_event_async_step_into(category, name, id, step, arg1_name, \
|
cef_trace_event_async_step_into(category, name, id, step, arg1_name, \
|
||||||
arg1_val, true)
|
arg1_val, true)
|
||||||
@ -441,44 +368,44 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|||||||
// within the async event. This should be called at the beginning of the next
|
// within the async event. This should be called at the beginning of the next
|
||||||
// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
|
// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
|
||||||
// ASYNC_STEP_INTO events.
|
// ASYNC_STEP_INTO events.
|
||||||
#define CEF_TRACE_EVENT_ASYNC_STEP_PAST0(category, name, id, step) \
|
#define TRACE_EVENT_ASYNC_STEP_PAST0(category, name, id, step) \
|
||||||
cef_trace_event_async_step_past(category, name, id, step, NULL, 0, false)
|
cef_trace_event_async_step_past(category, name, id, step, NULL, 0, false)
|
||||||
#define CEF_TRACE_EVENT_ASYNC_STEP_PAST1(category, name, id, step, \
|
#define TRACE_EVENT_ASYNC_STEP_PAST1(category, name, id, step, \
|
||||||
arg1_name, arg1_val) \
|
arg1_name, arg1_val) \
|
||||||
cef_trace_event_async_step_past(category, name, id, step, arg1_name, \
|
cef_trace_event_async_step_past(category, name, id, step, arg1_name, \
|
||||||
arg1_val, false)
|
arg1_val, false)
|
||||||
#define CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST0(category, name, id, step) \
|
#define TRACE_EVENT_COPY_ASYNC_STEP_PAST0(category, name, id, step) \
|
||||||
cef_trace_event_async_step_past(category, name, id, step, NULL, 0, true)
|
cef_trace_event_async_step_past(category, name, id, step, NULL, 0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST1(category, name, id, step, \
|
#define TRACE_EVENT_COPY_ASYNC_STEP_PAST1(category, name, id, step, \
|
||||||
arg1_name, arg1_val) \
|
arg1_name, arg1_val) \
|
||||||
cef_trace_event_async_step_past(category, name, id, step, arg1_name, \
|
cef_trace_event_async_step_past(category, name, id, step, arg1_name, \
|
||||||
arg1_val, true)
|
arg1_val, true)
|
||||||
|
|
||||||
// Records a single ASYNC_END event for "name" immediately. If the category
|
// Records a single ASYNC_END event for "name" immediately. If the category
|
||||||
// is not enabled, then this does nothing.
|
// is not enabled, then this does nothing.
|
||||||
#define CEF_TRACE_EVENT_ASYNC_END0(category, name, id) \
|
#define TRACE_EVENT_ASYNC_END0(category, name, id) \
|
||||||
cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0, false)
|
cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0, false)
|
||||||
#define CEF_TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
|
#define TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
|
||||||
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0, \
|
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0, \
|
||||||
false)
|
false)
|
||||||
#define CEF_TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
|
#define TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val) \
|
arg2_name, arg2_val) \
|
||||||
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \
|
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val, false)
|
arg2_name, arg2_val, false)
|
||||||
#define CEF_TRACE_EVENT_COPY_ASYNC_END0(category, name, id) \
|
#define TRACE_EVENT_COPY_ASYNC_END0(category, name, id) \
|
||||||
cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0, true)
|
cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0, true)
|
||||||
#define CEF_TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, \
|
#define TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, \
|
||||||
arg1_val) \
|
arg1_val) \
|
||||||
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0, \
|
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0, \
|
||||||
true)
|
true)
|
||||||
#define CEF_TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, \
|
#define TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, \
|
||||||
arg1_val, arg2_name, arg2_val) \
|
arg1_val, arg2_name, arg2_val) \
|
||||||
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \
|
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \
|
||||||
arg2_name, arg2_val, true)
|
arg2_name, arg2_val, true)
|
||||||
|
|
||||||
namespace cef_trace_event_internal {
|
namespace cef_trace_event {
|
||||||
|
|
||||||
// Used by CEF_TRACE_EVENTx macro. Do not use directly.
|
// Used by TRACE_EVENTx macro. Do not use directly.
|
||||||
class CefTraceEndOnScopeClose {
|
class CefTraceEndOnScopeClose {
|
||||||
public:
|
public:
|
||||||
CefTraceEndOnScopeClose(const char* category, const char* name)
|
CefTraceEndOnScopeClose(const char* category, const char* name)
|
||||||
@ -493,6 +420,8 @@ class CefTraceEndOnScopeClose {
|
|||||||
const char* name_;
|
const char* name_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // cef_trace_event_internal
|
} // cef_trace_event
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_CEF_TRACE_EVENT_H_
|
#endif // !BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_
|
@ -134,19 +134,19 @@ CEF_EXPORT cef_task_runner_t* cef_task_runner_get_for_thread(
|
|||||||
|
|
||||||
///
|
///
|
||||||
// Returns true (1) if called on the specified thread. Equivalent to using
|
// Returns true (1) if called on the specified thread. Equivalent to using
|
||||||
// cef_task_runner_t::GetForThread(threadId)->belongs_to_current_thread().
|
// cef_task_tRunner::GetForThread(threadId)->belongs_to_current_thread().
|
||||||
///
|
///
|
||||||
CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId);
|
CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Post a task for execution on the specified thread. Equivalent to using
|
// Post a task for execution on the specified thread. Equivalent to using
|
||||||
// cef_task_runner_t::GetForThread(threadId)->PostTask(task).
|
// cef_task_tRunner::GetForThread(threadId)->PostTask(task).
|
||||||
///
|
///
|
||||||
CEF_EXPORT int cef_post_task(cef_thread_id_t threadId, cef_task_t* task);
|
CEF_EXPORT int cef_post_task(cef_thread_id_t threadId, cef_task_t* task);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Post a task for delayed execution on the specified thread. Equivalent to
|
// Post a task for delayed execution on the specified thread. Equivalent to
|
||||||
// using cef_task_runner_t::GetForThread(threadId)->PostDelayedTask(task,
|
// using cef_task_tRunner::GetForThread(threadId)->PostDelayedTask(task,
|
||||||
// delay_ms).
|
// delay_ms).
|
||||||
///
|
///
|
||||||
CEF_EXPORT int cef_post_delayed_task(cef_thread_id_t threadId, cef_task_t* task,
|
CEF_EXPORT int cef_post_delayed_task(cef_thread_id_t threadId, cef_task_t* task,
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#define CEF_INCLUDE_CEF_BASE_H_
|
#define CEF_INCLUDE_CEF_BASE_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/internal/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
#include "include/internal/cef_ptr.h"
|
#include "include/internal/cef_ptr.h"
|
||||||
#include "include/internal/cef_types_wrappers.h"
|
#include "include/internal/cef_types_wrappers.h"
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/internal/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
|
||||||
#if defined(COMPILER_MSVC)
|
#if defined(COMPILER_MSVC)
|
||||||
|
|
||||||
|
66
include/internal/cef_logging_internal.h
Normal file
66
include/internal/cef_logging_internal.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||||
|
// Framework nor the names of its contributors may be used to endorse
|
||||||
|
// or promote products derived from this software without specific prior
|
||||||
|
// written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#ifndef CEF_INCLUDE_INTERNAL_CEF_LOGGING_INTERNAL_H_
|
||||||
|
#define CEF_INCLUDE_INTERNAL_CEF_LOGGING_INTERNAL_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/internal/cef_export.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// See include/base/cef_logging.h for macros and intended usage.
|
||||||
|
|
||||||
|
///
|
||||||
|
// Gets the current log level.
|
||||||
|
///
|
||||||
|
CEF_EXPORT int cef_get_min_log_level();
|
||||||
|
|
||||||
|
///
|
||||||
|
// Gets the current vlog level for the given file (usually taken from
|
||||||
|
// __FILE__). Note that |N| is the size *with* the null terminator.
|
||||||
|
///
|
||||||
|
CEF_EXPORT int cef_get_vlog_level(const char* file_start, size_t N);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Add a log message. See the LogSeverity defines for supported |severity|
|
||||||
|
// values.
|
||||||
|
///
|
||||||
|
CEF_EXPORT void cef_log(const char* file,
|
||||||
|
int line,
|
||||||
|
int severity,
|
||||||
|
const char* message);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_INTERNAL_CEF_LOGGING_INTERNAL_H_
|
@ -36,14 +36,15 @@
|
|||||||
// modification. It is the user's responsibility to provide synchronization if
|
// modification. It is the user's responsibility to provide synchronization if
|
||||||
// modifying CEF strings from multiple threads.
|
// modifying CEF strings from multiple threads.
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include "include/base/cef_build.h"
|
||||||
|
#include "include/internal/cef_export.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "include/internal/cef_build.h"
|
|
||||||
#include "include/internal/cef_export.h"
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
// CEF character type definitions. wchar_t is 2 bytes on Windows and 4 bytes on
|
// CEF character type definitions. wchar_t is 2 bytes on Windows and 4 bytes on
|
||||||
// most other platforms.
|
// most other platforms.
|
||||||
|
|
||||||
|
124
include/internal/cef_trace_event_internal.h
Normal file
124
include/internal/cef_trace_event_internal.h
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||||
|
// Framework nor the names of its contributors may be used to endorse
|
||||||
|
// or promote products derived from this software without specific prior
|
||||||
|
// written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#ifndef CEF_INCLUDE_INTERNAL_CEF_TRACE_EVENT_INTERNAL_H_
|
||||||
|
#define CEF_INCLUDE_INTERNAL_CEF_TRACE_EVENT_INTERNAL_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/internal/cef_export.h"
|
||||||
|
#include "include/internal/cef_types.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// See include/base/cef_trace_event.h for macros and intended usage.
|
||||||
|
|
||||||
|
// Functions for tracing counters and functions; called from macros.
|
||||||
|
// - |category| string must have application lifetime (static or literal). They
|
||||||
|
// may not include "(quotes) chars.
|
||||||
|
// - |argX_name|, |argX_val|, |valueX_name|, |valeX_val| are optional parameters
|
||||||
|
// and represent pairs of name and values of arguments
|
||||||
|
// - |copy| is used to avoid memory scoping issues with the |name| and
|
||||||
|
// |arg_name| parameters by copying them
|
||||||
|
// - |id| is used to disambiguate counters with the same name, or match async
|
||||||
|
// trace events
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_trace_event_instant(const char* category,
|
||||||
|
const char* name,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
const char* arg2_name,
|
||||||
|
uint64 arg2_val,
|
||||||
|
int copy);
|
||||||
|
CEF_EXPORT void cef_trace_event_begin(const char* category,
|
||||||
|
const char* name,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
const char* arg2_name,
|
||||||
|
uint64 arg2_val,
|
||||||
|
int copy);
|
||||||
|
CEF_EXPORT void cef_trace_event_end(const char* category,
|
||||||
|
const char* name,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
const char* arg2_name,
|
||||||
|
uint64 arg2_val,
|
||||||
|
int copy);
|
||||||
|
CEF_EXPORT void cef_trace_counter(const char* category,
|
||||||
|
const char* name,
|
||||||
|
const char* value1_name,
|
||||||
|
uint64 value1_val,
|
||||||
|
const char* value2_name,
|
||||||
|
uint64 value2_val,
|
||||||
|
int copy);
|
||||||
|
CEF_EXPORT void cef_trace_counter_id(const char* category,
|
||||||
|
const char* name,
|
||||||
|
uint64 id,
|
||||||
|
const char* value1_name,
|
||||||
|
uint64 value1_val,
|
||||||
|
const char* value2_name,
|
||||||
|
uint64 value2_val,
|
||||||
|
int copy);
|
||||||
|
CEF_EXPORT void cef_trace_event_async_begin(const char* category,
|
||||||
|
const char* name,
|
||||||
|
uint64 id,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
const char* arg2_name,
|
||||||
|
uint64 arg2_val,
|
||||||
|
int copy);
|
||||||
|
CEF_EXPORT void cef_trace_event_async_step_into(const char* category,
|
||||||
|
const char* name,
|
||||||
|
uint64 id,
|
||||||
|
uint64 step,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
int copy);
|
||||||
|
CEF_EXPORT void cef_trace_event_async_step_past(const char* category,
|
||||||
|
const char* name,
|
||||||
|
uint64 id,
|
||||||
|
uint64 step,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
int copy);
|
||||||
|
CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
||||||
|
const char* name,
|
||||||
|
uint64 id,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
const char* arg2_name,
|
||||||
|
uint64 arg2_val,
|
||||||
|
int copy);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_INTERNAL_CEF_TRACE_EVENT_INTERNAL_H_
|
@ -32,7 +32,7 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/internal/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
#include "include/internal/cef_string.h"
|
#include "include/internal/cef_string.h"
|
||||||
#include "include/internal/cef_string_list.h"
|
#include "include/internal/cef_string_list.h"
|
||||||
#include "include/internal/cef_time.h"
|
#include "include/internal/cef_time.h"
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_LINUX_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_LINUX_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/internal/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/internal/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
#include "include/internal/cef_string.h"
|
#include "include/internal/cef_string.h"
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/internal/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#define CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_
|
#define CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "include/cef_stream.h"
|
#include "include/cef_stream.h"
|
||||||
|
|
||||||
@ -70,6 +71,8 @@ class CefByteReadHandler : public CefReadHandler {
|
|||||||
|
|
||||||
IMPLEMENT_REFCOUNTING(CefByteReadHandler);
|
IMPLEMENT_REFCOUNTING(CefByteReadHandler);
|
||||||
IMPLEMENT_LOCKING(CefByteReadHandler);
|
IMPLEMENT_LOCKING(CefByteReadHandler);
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefByteReadHandler);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_
|
#endif // CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_
|
||||||
|
79
include/wrapper/cef_helpers.h
Normal file
79
include/wrapper/cef_helpers.h
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||||
|
// Framework nor the names of its contributors may be used to endorse
|
||||||
|
// or promote products derived from this software without specific prior
|
||||||
|
// written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// The contents of this file are only available to applications that link
|
||||||
|
// against the libcef_dll_wrapper target.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CEF_INCLUDE_WRAPPER_CEF_HELPERS_H_
|
||||||
|
#define CEF_INCLUDE_WRAPPER_CEF_HELPERS_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
|
#include "include/cef_task.h"
|
||||||
|
|
||||||
|
#define CEF_REQUIRE_UI_THREAD() DCHECK(CefCurrentlyOn(TID_UI));
|
||||||
|
#define CEF_REQUIRE_IO_THREAD() DCHECK(CefCurrentlyOn(TID_IO));
|
||||||
|
#define CEF_REQUIRE_FILE_THREAD() DCHECK(CefCurrentlyOn(TID_FILE));
|
||||||
|
#define CEF_REQUIRE_RENDERER_THREAD() DCHECK(CefCurrentlyOn(TID_RENDERER));
|
||||||
|
|
||||||
|
// Helper class to manage a scoped copy of |argv|.
|
||||||
|
class CefScopedArgArray {
|
||||||
|
public:
|
||||||
|
CefScopedArgArray(int argc, char* argv[]) {
|
||||||
|
array_ = new char*[argc];
|
||||||
|
for (int i = 0; i < argc; ++i) {
|
||||||
|
values_.push_back(argv[i]);
|
||||||
|
array_[i] = const_cast<char*>(values_[i].c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~CefScopedArgArray() {
|
||||||
|
delete [] array_;
|
||||||
|
}
|
||||||
|
|
||||||
|
char** array() const { return array_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
char** array_;
|
||||||
|
|
||||||
|
// Keep values in a vector separate from |array_| because various users may
|
||||||
|
// modify |array_| and we still want to clean up memory properly.
|
||||||
|
std::vector<std::string> values_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefScopedArgArray);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_WRAPPER_CEF_HELPERS_H_
|
@ -37,6 +37,7 @@
|
|||||||
#define CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_
|
#define CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "include/cef_resource_handler.h"
|
#include "include/cef_resource_handler.h"
|
||||||
#include "include/cef_response.h"
|
#include "include/cef_response.h"
|
||||||
@ -96,6 +97,8 @@ class CefStreamResourceHandler : public CefResourceHandler {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTING(CefStreamResourceHandler);
|
IMPLEMENT_REFCOUNTING(CefStreamResourceHandler);
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefStreamResourceHandler);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_
|
#endif // CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#define CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_
|
#define CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "include/cef_xml_reader.h"
|
#include "include/cef_xml_reader.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -183,6 +184,8 @@ class CefXmlObject : public CefBase {
|
|||||||
|
|
||||||
IMPLEMENT_REFCOUNTING(CefXmlObject);
|
IMPLEMENT_REFCOUNTING(CefXmlObject);
|
||||||
IMPLEMENT_LOCKING(CefXmlObject);
|
IMPLEMENT_LOCKING(CefXmlObject);
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefXmlObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_
|
#endif // CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#define CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_
|
#define CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@ -130,6 +131,8 @@ class CefZipArchive : public CefBase {
|
|||||||
|
|
||||||
IMPLEMENT_REFCOUNTING(CefZipArchive);
|
IMPLEMENT_REFCOUNTING(CefZipArchive);
|
||||||
IMPLEMENT_LOCKING(CefZipArchive);
|
IMPLEMENT_LOCKING(CefZipArchive);
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefZipArchive);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_
|
#endif // CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_
|
||||||
|
@ -3,12 +3,10 @@
|
|||||||
// be found in the LICENSE file.
|
// be found in the LICENSE file.
|
||||||
|
|
||||||
#include "include/cef_trace.h"
|
#include "include/cef_trace.h"
|
||||||
#include "include/cef_trace_event.h"
|
|
||||||
#include "libcef/browser/trace_subscriber.h"
|
#include "libcef/browser/trace_subscriber.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
#include "base/debug/trace_event.h"
|
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
|
|
||||||
bool CefBeginTracing(const CefString& categories,
|
bool CefBeginTracing(const CefString& categories,
|
||||||
@ -52,297 +50,3 @@ bool CefEndTracing(const CefString& tracing_file,
|
|||||||
int64 CefNowFromSystemTraceTime() {
|
int64 CefNowFromSystemTraceTime() {
|
||||||
return base::TimeTicks::NowFromSystemTraceTime().ToInternalValue();
|
return base::TimeTicks::NowFromSystemTraceTime().ToInternalValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The below functions can be called from any process.
|
|
||||||
|
|
||||||
CEF_EXPORT void cef_trace_event_instant(const char* category,
|
|
||||||
const char* name,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
const char* arg2_name,
|
|
||||||
uint64 arg2_val,
|
|
||||||
int copy) {
|
|
||||||
DCHECK(category);
|
|
||||||
DCHECK(name);
|
|
||||||
if (!category || !name)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (copy) {
|
|
||||||
if (arg1_name == NULL && arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_COPY_INSTANT0(category, name, TRACE_EVENT_SCOPE_THREAD);
|
|
||||||
} else if (arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_COPY_INSTANT1(category, name, TRACE_EVENT_SCOPE_THREAD,
|
|
||||||
arg1_name, arg1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_COPY_INSTANT2(category, name, TRACE_EVENT_SCOPE_THREAD,
|
|
||||||
arg1_name, arg1_val, arg2_name, arg2_val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (arg1_name == NULL && arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_INSTANT0(category, name, TRACE_EVENT_SCOPE_THREAD);
|
|
||||||
} else if (arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_INSTANT1(category, name, TRACE_EVENT_SCOPE_THREAD,
|
|
||||||
arg1_name, arg1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_INSTANT2(category, name, TRACE_EVENT_SCOPE_THREAD,
|
|
||||||
arg1_name, arg1_val, arg2_name, arg2_val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT void cef_trace_event_begin(const char* category,
|
|
||||||
const char* name,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
const char* arg2_name,
|
|
||||||
uint64 arg2_val,
|
|
||||||
int copy) {
|
|
||||||
DCHECK(category);
|
|
||||||
DCHECK(name);
|
|
||||||
if (!category || !name)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (copy) {
|
|
||||||
if (arg1_name == NULL && arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_COPY_BEGIN0(category, name);
|
|
||||||
} else if (arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val,
|
|
||||||
arg2_name, arg2_val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (arg1_name == NULL && arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_BEGIN0(category, name);
|
|
||||||
} else if (arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val,
|
|
||||||
arg2_name, arg2_val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT void cef_trace_event_end(const char* category,
|
|
||||||
const char* name,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
const char* arg2_name,
|
|
||||||
uint64 arg2_val,
|
|
||||||
int copy) {
|
|
||||||
DCHECK(category);
|
|
||||||
DCHECK(name);
|
|
||||||
if (!category || !name)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (copy) {
|
|
||||||
if (arg1_name == NULL && arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_COPY_END0(category, name);
|
|
||||||
} else if (arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val,
|
|
||||||
arg2_name, arg2_val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (arg1_name == NULL && arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_END0(category, name);
|
|
||||||
} else if (arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_END1(category, name, arg1_name, arg1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_END2(category, name, arg1_name, arg1_val,
|
|
||||||
arg2_name, arg2_val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT void cef_trace_counter(const char* category,
|
|
||||||
const char* name,
|
|
||||||
const char* value1_name,
|
|
||||||
uint64 value1_val,
|
|
||||||
const char* value2_name,
|
|
||||||
uint64 value2_val,
|
|
||||||
int copy) {
|
|
||||||
DCHECK(category);
|
|
||||||
DCHECK(name);
|
|
||||||
if (!category || !name)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (copy) {
|
|
||||||
if (value1_name == NULL && value2_name == NULL) {
|
|
||||||
TRACE_COPY_COUNTER1(category, name, value1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_COPY_COUNTER2(category, name, value1_name, value1_val,
|
|
||||||
value2_name, value2_val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (value1_name == NULL && value2_name == NULL) {
|
|
||||||
TRACE_COUNTER1(category, name, value1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_COUNTER2(category, name, value1_name, value1_val,
|
|
||||||
value2_name, value2_val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT void cef_trace_counter_id(const char* category,
|
|
||||||
const char* name,
|
|
||||||
uint64 id,
|
|
||||||
const char* value1_name,
|
|
||||||
uint64 value1_val,
|
|
||||||
const char* value2_name,
|
|
||||||
uint64 value2_val,
|
|
||||||
int copy) {
|
|
||||||
DCHECK(category);
|
|
||||||
DCHECK(name);
|
|
||||||
if (!category || !name)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (copy) {
|
|
||||||
if (value1_name == NULL && value2_name == NULL) {
|
|
||||||
TRACE_COPY_COUNTER_ID1(category, name, id, value1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_COPY_COUNTER_ID2(category, name, id, value1_name,
|
|
||||||
value1_val, value2_name, value2_val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (value1_name == NULL && value2_name == NULL) {
|
|
||||||
TRACE_COUNTER_ID1(category, name, id, value1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_COUNTER_ID2(category, name, id, value1_name, value1_val,
|
|
||||||
value2_name, value2_val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT void cef_trace_event_async_begin(const char* category,
|
|
||||||
const char* name,
|
|
||||||
uint64 id,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
const char* arg2_name,
|
|
||||||
uint64 arg2_val,
|
|
||||||
int copy) {
|
|
||||||
DCHECK(category);
|
|
||||||
DCHECK(name);
|
|
||||||
if (!category || !name)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (copy) {
|
|
||||||
if (arg1_name == NULL && arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_COPY_ASYNC_BEGIN0(category, name, id);
|
|
||||||
} else if (arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_COPY_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_COPY_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val,
|
|
||||||
arg2_name, arg2_val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (arg1_name == NULL && arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_ASYNC_BEGIN0(category, name, id);
|
|
||||||
} else if (arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val,
|
|
||||||
arg2_name, arg2_val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT void cef_trace_event_async_step_into(const char* category,
|
|
||||||
const char* name,
|
|
||||||
uint64 id,
|
|
||||||
uint64 step,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
int copy) {
|
|
||||||
DCHECK(category);
|
|
||||||
DCHECK(name);
|
|
||||||
if (!category || !name)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (copy) {
|
|
||||||
if (arg1_name == NULL) {
|
|
||||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_INTO,
|
|
||||||
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step);
|
|
||||||
} else {
|
|
||||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_INTO,
|
|
||||||
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step,
|
|
||||||
arg1_name, arg1_val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (arg1_name == NULL) {
|
|
||||||
TRACE_EVENT_ASYNC_STEP_INTO0(category, name, id, step);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_ASYNC_STEP_INTO1(category, name, id, step,
|
|
||||||
arg1_name, arg1_val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT void cef_trace_event_async_step_past(const char* category,
|
|
||||||
const char* name,
|
|
||||||
uint64 id,
|
|
||||||
uint64 step,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
int copy) {
|
|
||||||
DCHECK(category);
|
|
||||||
DCHECK(name);
|
|
||||||
if (!category || !name)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (copy) {
|
|
||||||
if (arg1_name == NULL) {
|
|
||||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_PAST,
|
|
||||||
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step);
|
|
||||||
} else {
|
|
||||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_PAST,
|
|
||||||
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step,
|
|
||||||
arg1_name, arg1_val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (arg1_name == NULL) {
|
|
||||||
TRACE_EVENT_ASYNC_STEP_PAST0(category, name, id, step);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_ASYNC_STEP_PAST1(category, name, id, step,
|
|
||||||
arg1_name, arg1_val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
|
||||||
const char* name,
|
|
||||||
uint64 id,
|
|
||||||
const char* arg1_name,
|
|
||||||
uint64 arg1_val,
|
|
||||||
const char* arg2_name,
|
|
||||||
uint64 arg2_val,
|
|
||||||
int copy) {
|
|
||||||
DCHECK(category);
|
|
||||||
DCHECK(name);
|
|
||||||
if (!category || !name)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (copy) {
|
|
||||||
if (arg1_name == NULL && arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_COPY_ASYNC_END0(category, name, id);
|
|
||||||
} else if (arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name,
|
|
||||||
arg1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name,
|
|
||||||
arg1_val, arg2_name, arg2_val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (arg1_name == NULL && arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_ASYNC_END0(category, name, id);
|
|
||||||
} else if (arg2_name == NULL) {
|
|
||||||
TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name,
|
|
||||||
arg1_val);
|
|
||||||
} else {
|
|
||||||
TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name,
|
|
||||||
arg1_val, arg2_name, arg2_val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
330
libcef/common/base_impl.cc
Normal file
330
libcef/common/base_impl.cc
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||||
|
// be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "include/internal/cef_trace_event_internal.h"
|
||||||
|
#include "include/internal/cef_logging_internal.h"
|
||||||
|
|
||||||
|
#include "base/debug/trace_event.h"
|
||||||
|
#include "base/logging.h"
|
||||||
|
|
||||||
|
// The contents of this file are a compilation unit that is not called by other
|
||||||
|
// functions in the the library. Consiquently MSVS will exclude it during the
|
||||||
|
// linker stage if we don't call a stub function.
|
||||||
|
#if defined(COMPILER_MSVC)
|
||||||
|
#pragma optimize("", off)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void base_impl_stub() {}
|
||||||
|
|
||||||
|
#if defined(COMPILER_MSVC)
|
||||||
|
#pragma optimize("", on)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_trace_event_instant(const char* category,
|
||||||
|
const char* name,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
const char* arg2_name,
|
||||||
|
uint64 arg2_val,
|
||||||
|
int copy) {
|
||||||
|
DCHECK(category);
|
||||||
|
DCHECK(name);
|
||||||
|
if (!category || !name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (copy) {
|
||||||
|
if (arg1_name == NULL && arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_COPY_INSTANT0(category, name, TRACE_EVENT_SCOPE_THREAD);
|
||||||
|
} else if (arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_COPY_INSTANT1(category, name, TRACE_EVENT_SCOPE_THREAD,
|
||||||
|
arg1_name, arg1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_COPY_INSTANT2(category, name, TRACE_EVENT_SCOPE_THREAD,
|
||||||
|
arg1_name, arg1_val, arg2_name, arg2_val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (arg1_name == NULL && arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_INSTANT0(category, name, TRACE_EVENT_SCOPE_THREAD);
|
||||||
|
} else if (arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_INSTANT1(category, name, TRACE_EVENT_SCOPE_THREAD,
|
||||||
|
arg1_name, arg1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_INSTANT2(category, name, TRACE_EVENT_SCOPE_THREAD,
|
||||||
|
arg1_name, arg1_val, arg2_name, arg2_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_trace_event_begin(const char* category,
|
||||||
|
const char* name,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
const char* arg2_name,
|
||||||
|
uint64 arg2_val,
|
||||||
|
int copy) {
|
||||||
|
DCHECK(category);
|
||||||
|
DCHECK(name);
|
||||||
|
if (!category || !name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (copy) {
|
||||||
|
if (arg1_name == NULL && arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_COPY_BEGIN0(category, name);
|
||||||
|
} else if (arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val,
|
||||||
|
arg2_name, arg2_val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (arg1_name == NULL && arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_BEGIN0(category, name);
|
||||||
|
} else if (arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val,
|
||||||
|
arg2_name, arg2_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_trace_event_end(const char* category,
|
||||||
|
const char* name,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
const char* arg2_name,
|
||||||
|
uint64 arg2_val,
|
||||||
|
int copy) {
|
||||||
|
DCHECK(category);
|
||||||
|
DCHECK(name);
|
||||||
|
if (!category || !name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (copy) {
|
||||||
|
if (arg1_name == NULL && arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_COPY_END0(category, name);
|
||||||
|
} else if (arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val,
|
||||||
|
arg2_name, arg2_val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (arg1_name == NULL && arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_END0(category, name);
|
||||||
|
} else if (arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_END1(category, name, arg1_name, arg1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_END2(category, name, arg1_name, arg1_val,
|
||||||
|
arg2_name, arg2_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_trace_counter(const char* category,
|
||||||
|
const char* name,
|
||||||
|
const char* value1_name,
|
||||||
|
uint64 value1_val,
|
||||||
|
const char* value2_name,
|
||||||
|
uint64 value2_val,
|
||||||
|
int copy) {
|
||||||
|
DCHECK(category);
|
||||||
|
DCHECK(name);
|
||||||
|
if (!category || !name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (copy) {
|
||||||
|
if (value1_name == NULL && value2_name == NULL) {
|
||||||
|
TRACE_COPY_COUNTER1(category, name, value1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_COPY_COUNTER2(category, name, value1_name, value1_val,
|
||||||
|
value2_name, value2_val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (value1_name == NULL && value2_name == NULL) {
|
||||||
|
TRACE_COUNTER1(category, name, value1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_COUNTER2(category, name, value1_name, value1_val,
|
||||||
|
value2_name, value2_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_trace_counter_id(const char* category,
|
||||||
|
const char* name,
|
||||||
|
uint64 id,
|
||||||
|
const char* value1_name,
|
||||||
|
uint64 value1_val,
|
||||||
|
const char* value2_name,
|
||||||
|
uint64 value2_val,
|
||||||
|
int copy) {
|
||||||
|
DCHECK(category);
|
||||||
|
DCHECK(name);
|
||||||
|
if (!category || !name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (copy) {
|
||||||
|
if (value1_name == NULL && value2_name == NULL) {
|
||||||
|
TRACE_COPY_COUNTER_ID1(category, name, id, value1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_COPY_COUNTER_ID2(category, name, id, value1_name,
|
||||||
|
value1_val, value2_name, value2_val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (value1_name == NULL && value2_name == NULL) {
|
||||||
|
TRACE_COUNTER_ID1(category, name, id, value1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_COUNTER_ID2(category, name, id, value1_name, value1_val,
|
||||||
|
value2_name, value2_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_trace_event_async_begin(const char* category,
|
||||||
|
const char* name,
|
||||||
|
uint64 id,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
const char* arg2_name,
|
||||||
|
uint64 arg2_val,
|
||||||
|
int copy) {
|
||||||
|
DCHECK(category);
|
||||||
|
DCHECK(name);
|
||||||
|
if (!category || !name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (copy) {
|
||||||
|
if (arg1_name == NULL && arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_COPY_ASYNC_BEGIN0(category, name, id);
|
||||||
|
} else if (arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_COPY_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_COPY_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val,
|
||||||
|
arg2_name, arg2_val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (arg1_name == NULL && arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_ASYNC_BEGIN0(category, name, id);
|
||||||
|
} else if (arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val,
|
||||||
|
arg2_name, arg2_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_trace_event_async_step_into(const char* category,
|
||||||
|
const char* name,
|
||||||
|
uint64 id,
|
||||||
|
uint64 step,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
int copy) {
|
||||||
|
DCHECK(category);
|
||||||
|
DCHECK(name);
|
||||||
|
if (!category || !name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (copy) {
|
||||||
|
if (arg1_name == NULL) {
|
||||||
|
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_INTO,
|
||||||
|
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step);
|
||||||
|
} else {
|
||||||
|
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_INTO,
|
||||||
|
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step,
|
||||||
|
arg1_name, arg1_val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (arg1_name == NULL) {
|
||||||
|
TRACE_EVENT_ASYNC_STEP_INTO0(category, name, id, step);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_ASYNC_STEP_INTO1(category, name, id, step,
|
||||||
|
arg1_name, arg1_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_trace_event_async_step_past(const char* category,
|
||||||
|
const char* name,
|
||||||
|
uint64 id,
|
||||||
|
uint64 step,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
int copy) {
|
||||||
|
DCHECK(category);
|
||||||
|
DCHECK(name);
|
||||||
|
if (!category || !name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (copy) {
|
||||||
|
if (arg1_name == NULL) {
|
||||||
|
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_PAST,
|
||||||
|
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step);
|
||||||
|
} else {
|
||||||
|
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_PAST,
|
||||||
|
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step,
|
||||||
|
arg1_name, arg1_val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (arg1_name == NULL) {
|
||||||
|
TRACE_EVENT_ASYNC_STEP_PAST0(category, name, id, step);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_ASYNC_STEP_PAST1(category, name, id, step,
|
||||||
|
arg1_name, arg1_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
||||||
|
const char* name,
|
||||||
|
uint64 id,
|
||||||
|
const char* arg1_name,
|
||||||
|
uint64 arg1_val,
|
||||||
|
const char* arg2_name,
|
||||||
|
uint64 arg2_val,
|
||||||
|
int copy) {
|
||||||
|
DCHECK(category);
|
||||||
|
DCHECK(name);
|
||||||
|
if (!category || !name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (copy) {
|
||||||
|
if (arg1_name == NULL && arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_COPY_ASYNC_END0(category, name, id);
|
||||||
|
} else if (arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name,
|
||||||
|
arg1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name,
|
||||||
|
arg1_val, arg2_name, arg2_val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (arg1_name == NULL && arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_ASYNC_END0(category, name, id);
|
||||||
|
} else if (arg2_name == NULL) {
|
||||||
|
TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name,
|
||||||
|
arg1_val);
|
||||||
|
} else {
|
||||||
|
TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name,
|
||||||
|
arg1_val, arg2_name, arg2_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_get_min_log_level() {
|
||||||
|
return logging::GetMinLogLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_get_vlog_level(const char* file_start, size_t N) {
|
||||||
|
return logging::GetVlogLevelHelper(file_start, N);
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT void cef_log(const char* file,
|
||||||
|
int line,
|
||||||
|
int severity,
|
||||||
|
const char* message) {
|
||||||
|
logging::LogMessage(file, line, severity).stream() << message;
|
||||||
|
}
|
@ -185,6 +185,10 @@ class CefUIThread : public base::Thread {
|
|||||||
|
|
||||||
CefMainDelegate::CefMainDelegate(CefRefPtr<CefApp> application)
|
CefMainDelegate::CefMainDelegate(CefRefPtr<CefApp> application)
|
||||||
: content_client_(application) {
|
: content_client_(application) {
|
||||||
|
// Necessary so that exported functions from base_impl.cc will be included
|
||||||
|
// in the binary.
|
||||||
|
extern void base_impl_stub();
|
||||||
|
base_impl_stub();
|
||||||
}
|
}
|
||||||
|
|
||||||
CefMainDelegate::~CefMainDelegate() {
|
CefMainDelegate::~CefMainDelegate() {
|
||||||
|
@ -45,20 +45,6 @@ using blink::WebString;
|
|||||||
using blink::WebURL;
|
using blink::WebURL;
|
||||||
using blink::WebView;
|
using blink::WebView;
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
blink::WebString FilePathStringToWebString(
|
|
||||||
const base::FilePath::StringType& str) {
|
|
||||||
#if defined(OS_POSIX)
|
|
||||||
return base::WideToUTF16(base::SysNativeMBToWide(str));
|
|
||||||
#elif defined(OS_WIN)
|
|
||||||
return base::WideToUTF16(str);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
|
|
||||||
// CefBrowserImpl static methods.
|
// CefBrowserImpl static methods.
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
257
libcef_dll/base/cef_logging.cc
Normal file
257
libcef_dll/base/cef_logging.cc
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
// Copyright (c) 2014 The Chromium Embedded Framework Authors.
|
||||||
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
#include <windows.h>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <sstream>
|
||||||
|
#elif defined(OS_POSIX)
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "include/internal/cef_string_types.h"
|
||||||
|
|
||||||
|
namespace cef_logging {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
#if defined(OS_POSIX)
|
||||||
|
// From base/safe_strerror_posix.cc.
|
||||||
|
|
||||||
|
#define USE_HISTORICAL_STRERRO_R (defined(__GLIBC__) || defined(OS_NACL))
|
||||||
|
|
||||||
|
#if USE_HISTORICAL_STRERRO_R && defined(__GNUC__)
|
||||||
|
// GCC will complain about the unused second wrap function unless we tell it
|
||||||
|
// that we meant for them to be potentially unused, which is exactly what this
|
||||||
|
// attribute is for.
|
||||||
|
#define POSSIBLY_UNUSED __attribute__((unused))
|
||||||
|
#else
|
||||||
|
#define POSSIBLY_UNUSED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_HISTORICAL_STRERRO_R
|
||||||
|
// glibc has two strerror_r functions: a historical GNU-specific one that
|
||||||
|
// returns type char *, and a POSIX.1-2001 compliant one available since 2.3.4
|
||||||
|
// that returns int. This wraps the GNU-specific one.
|
||||||
|
static void POSSIBLY_UNUSED wrap_posix_strerror_r(
|
||||||
|
char *(*strerror_r_ptr)(int, char *, size_t),
|
||||||
|
int err,
|
||||||
|
char *buf,
|
||||||
|
size_t len) {
|
||||||
|
// GNU version.
|
||||||
|
char *rc = (*strerror_r_ptr)(err, buf, len);
|
||||||
|
if (rc != buf) {
|
||||||
|
// glibc did not use buf and returned a static string instead. Copy it
|
||||||
|
// into buf.
|
||||||
|
buf[0] = '\0';
|
||||||
|
strncat(buf, rc, len - 1);
|
||||||
|
}
|
||||||
|
// The GNU version never fails. Unknown errors get an "unknown error" message.
|
||||||
|
// The result is always null terminated.
|
||||||
|
}
|
||||||
|
#endif // USE_HISTORICAL_STRERRO_R
|
||||||
|
|
||||||
|
// Wrapper for strerror_r functions that implement the POSIX interface. POSIX
|
||||||
|
// does not define the behaviour for some of the edge cases, so we wrap it to
|
||||||
|
// guarantee that they are handled. This is compiled on all POSIX platforms, but
|
||||||
|
// it will only be used on Linux if the POSIX strerror_r implementation is
|
||||||
|
// being used (see below).
|
||||||
|
static void POSSIBLY_UNUSED wrap_posix_strerror_r(
|
||||||
|
int (*strerror_r_ptr)(int, char *, size_t),
|
||||||
|
int err,
|
||||||
|
char *buf,
|
||||||
|
size_t len) {
|
||||||
|
int old_errno = errno;
|
||||||
|
// Have to cast since otherwise we get an error if this is the GNU version
|
||||||
|
// (but in such a scenario this function is never called). Sadly we can't use
|
||||||
|
// C++-style casts because the appropriate one is reinterpret_cast but it's
|
||||||
|
// considered illegal to reinterpret_cast a type to itself, so we get an
|
||||||
|
// error in the opposite case.
|
||||||
|
int result = (*strerror_r_ptr)(err, buf, len);
|
||||||
|
if (result == 0) {
|
||||||
|
// POSIX is vague about whether the string will be terminated, although
|
||||||
|
// it indirectly implies that typically ERANGE will be returned, instead
|
||||||
|
// of truncating the string. We play it safe by always terminating the
|
||||||
|
// string explicitly.
|
||||||
|
buf[len - 1] = '\0';
|
||||||
|
} else {
|
||||||
|
// Error. POSIX is vague about whether the return value is itself a system
|
||||||
|
// error code or something else. On Linux currently it is -1 and errno is
|
||||||
|
// set. On BSD-derived systems it is a system error and errno is unchanged.
|
||||||
|
// We try and detect which case it is so as to put as much useful info as
|
||||||
|
// we can into our message.
|
||||||
|
int strerror_error; // The error encountered in strerror
|
||||||
|
int new_errno = errno;
|
||||||
|
if (new_errno != old_errno) {
|
||||||
|
// errno was changed, so probably the return value is just -1 or something
|
||||||
|
// else that doesn't provide any info, and errno is the error.
|
||||||
|
strerror_error = new_errno;
|
||||||
|
} else {
|
||||||
|
// Either the error from strerror_r was the same as the previous value, or
|
||||||
|
// errno wasn't used. Assume the latter.
|
||||||
|
strerror_error = result;
|
||||||
|
}
|
||||||
|
// snprintf truncates and always null-terminates.
|
||||||
|
snprintf(buf,
|
||||||
|
len,
|
||||||
|
"Error %d while retrieving error %d",
|
||||||
|
strerror_error,
|
||||||
|
err);
|
||||||
|
}
|
||||||
|
errno = old_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
void safe_strerror_r(int err, char *buf, size_t len) {
|
||||||
|
if (buf == NULL || len <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If using glibc (i.e., Linux), the compiler will automatically select the
|
||||||
|
// appropriate overloaded function based on the function type of strerror_r.
|
||||||
|
// The other one will be elided from the translation unit since both are
|
||||||
|
// static.
|
||||||
|
wrap_posix_strerror_r(&strerror_r, err, buf, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string safe_strerror(int err) {
|
||||||
|
const int buffer_size = 256;
|
||||||
|
char buf[buffer_size];
|
||||||
|
safe_strerror_r(err, buf, sizeof(buf));
|
||||||
|
return std::string(buf);
|
||||||
|
}
|
||||||
|
#endif // defined(OS_POSIX)
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
// MSVC doesn't like complex extern templates and DLLs.
|
||||||
|
#if !defined(COMPILER_MSVC)
|
||||||
|
// Explicit instantiations for commonly used comparisons.
|
||||||
|
template std::string* MakeCheckOpString<int, int>(
|
||||||
|
const int&, const int&, const char* names);
|
||||||
|
template std::string* MakeCheckOpString<unsigned long, unsigned long>(
|
||||||
|
const unsigned long&, const unsigned long&, const char* names);
|
||||||
|
template std::string* MakeCheckOpString<unsigned long, unsigned int>(
|
||||||
|
const unsigned long&, const unsigned int&, const char* names);
|
||||||
|
template std::string* MakeCheckOpString<unsigned int, unsigned long>(
|
||||||
|
const unsigned int&, const unsigned long&, const char* names);
|
||||||
|
template std::string* MakeCheckOpString<std::string, std::string>(
|
||||||
|
const std::string&, const std::string&, const char* name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
LogMessage::SaveLastError::SaveLastError() : last_error_(::GetLastError()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
LogMessage::SaveLastError::~SaveLastError() {
|
||||||
|
::SetLastError(last_error_);
|
||||||
|
}
|
||||||
|
#endif // defined(OS_WIN)
|
||||||
|
|
||||||
|
LogMessage::LogMessage(const char* file, int line, LogSeverity severity)
|
||||||
|
: severity_(severity), file_(file), line_(line) {
|
||||||
|
}
|
||||||
|
|
||||||
|
LogMessage::LogMessage(const char* file, int line, std::string* result)
|
||||||
|
: severity_(LOG_FATAL), file_(file), line_(line) {
|
||||||
|
stream_ << "Check failed: " << *result;
|
||||||
|
delete result;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
|
||||||
|
std::string* result)
|
||||||
|
: severity_(severity), file_(file), line_(line) {
|
||||||
|
stream_ << "Check failed: " << *result;
|
||||||
|
delete result;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogMessage::~LogMessage() {
|
||||||
|
stream_ << std::endl;
|
||||||
|
std::string str_newline(stream_.str());
|
||||||
|
cef_log(file_, line_, severity_, str_newline.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
// This has already been defined in the header, but defining it again as DWORD
|
||||||
|
// ensures that the type used in the header is equivalent to DWORD. If not,
|
||||||
|
// the redefinition is a compile error.
|
||||||
|
typedef DWORD SystemErrorCode;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SystemErrorCode GetLastSystemErrorCode() {
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
return ::GetLastError();
|
||||||
|
#elif defined(OS_POSIX)
|
||||||
|
return errno;
|
||||||
|
#else
|
||||||
|
#error Not implemented
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
std::string SystemErrorCodeToString(SystemErrorCode error_code) {
|
||||||
|
const int error_message_buffer_size = 256;
|
||||||
|
char msgbuf[error_message_buffer_size];
|
||||||
|
DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
|
||||||
|
DWORD len = FormatMessageA(flags, NULL, error_code, 0, msgbuf,
|
||||||
|
arraysize(msgbuf), NULL);
|
||||||
|
std::stringstream ss;
|
||||||
|
if (len) {
|
||||||
|
std::string s(msgbuf);
|
||||||
|
// Messages returned by system end with line breaks.
|
||||||
|
s.erase(std::remove_if(s.begin(), s.end(), ::isspace), s.end());
|
||||||
|
ss << s << " (0x" << std::hex << error_code << ")";
|
||||||
|
} else {
|
||||||
|
ss << "Error (0x" << std::hex << GetLastError() <<
|
||||||
|
") while retrieving error. (0x" << error_code << ")";
|
||||||
|
}
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
#elif defined(OS_POSIX)
|
||||||
|
std::string SystemErrorCodeToString(SystemErrorCode error_code) {
|
||||||
|
return safe_strerror(error_code);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#error Not implemented
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
Win32ErrorLogMessage::Win32ErrorLogMessage(const char* file,
|
||||||
|
int line,
|
||||||
|
LogSeverity severity,
|
||||||
|
SystemErrorCode err)
|
||||||
|
: err_(err),
|
||||||
|
log_message_(file, line, severity) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Win32ErrorLogMessage::~Win32ErrorLogMessage() {
|
||||||
|
stream() << ": " << SystemErrorCodeToString(err_);
|
||||||
|
}
|
||||||
|
#elif defined(OS_POSIX)
|
||||||
|
ErrnoLogMessage::ErrnoLogMessage(const char* file,
|
||||||
|
int line,
|
||||||
|
LogSeverity severity,
|
||||||
|
SystemErrorCode err)
|
||||||
|
: err_(err),
|
||||||
|
log_message_(file, line, severity) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrnoLogMessage::~ErrnoLogMessage() {
|
||||||
|
stream() << ": " << SystemErrorCodeToString(err_);
|
||||||
|
}
|
||||||
|
#endif // OS_WIN
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) {
|
||||||
|
cef_string_utf8_t str = {0};
|
||||||
|
std::wstring tmp_str(wstr);
|
||||||
|
cef_string_wide_to_utf8(wstr, tmp_str.size(), &str);
|
||||||
|
out << str.str;
|
||||||
|
cef_string_utf8_clear(&str);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace cef_logging
|
@ -1,35 +0,0 @@
|
|||||||
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
|
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
|
||||||
// can be found in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef CEF_LIBCEF_DLL_CEF_LOGGING_H_
|
|
||||||
#define CEF_LIBCEF_DLL_CEF_LOGGING_H_
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "include/cef_task.h"
|
|
||||||
|
|
||||||
#ifdef BUILDING_CEF_SHARED
|
|
||||||
#include "base/logging.h"
|
|
||||||
#else // !BUILDING_CEF_SHARED
|
|
||||||
#include <assert.h> // NOLINT(build/include_order)
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
#define DCHECK(condition) assert(condition)
|
|
||||||
#else
|
|
||||||
#define DCHECK(condition) ((void)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DCHECK_EQ(val1, val2) DCHECK(val1 == val2)
|
|
||||||
#define DCHECK_NE(val1, val2) DCHECK(val1 != val2)
|
|
||||||
#define DCHECK_LE(val1, val2) DCHECK(val1 <= val2)
|
|
||||||
#define DCHECK_LT(val1, val2) DCHECK(val1 < val2)
|
|
||||||
#define DCHECK_GE(val1, val2) DCHECK(val1 >= val2)
|
|
||||||
#define DCHECK_GT(val1, val2) DCHECK(val1 > val2)
|
|
||||||
#endif // !BUILDING_CEF_SHARED
|
|
||||||
|
|
||||||
#define CEF_REQUIRE_UI_THREAD() DCHECK(CefCurrentlyOn(TID_UI));
|
|
||||||
#define CEF_REQUIRE_IO_THREAD() DCHECK(CefCurrentlyOn(TID_IO));
|
|
||||||
#define CEF_REQUIRE_FILE_THREAD() DCHECK(CefCurrentlyOn(TID_FILE));
|
|
||||||
#define CEF_REQUIRE_RENDERER_THREAD() DCHECK(CefCurrentlyOn(TID_RENDERER));
|
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_DLL_CEF_LOGGING_H_
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
|
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
|
||||||
// can be found in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef CEF_LIBCEF_DLL_CEF_MACROS_H_
|
|
||||||
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef BUILDING_CEF_SHARED
|
|
||||||
#include "base/macros.h"
|
|
||||||
#else // !BUILDING_CEF_SHARED
|
|
||||||
|
|
||||||
// A macro to disallow the copy constructor and operator= functions
|
|
||||||
// This should be used in the private: declarations for a class
|
|
||||||
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
|
||||||
TypeName(const TypeName&); \
|
|
||||||
void operator=(const TypeName&)
|
|
||||||
|
|
||||||
#endif // !BUILDING_CEF_SHARED
|
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_DLL_CEF_MACROS_H_
|
|
@ -6,10 +6,10 @@
|
|||||||
#define CEF_LIBCEF_DLL_CPPTOC_BASE_CPPTOC_H_
|
#define CEF_LIBCEF_DLL_CPPTOC_BASE_CPPTOC_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "include/capi/cef_base_capi.h"
|
#include "include/capi/cef_base_capi.h"
|
||||||
#include "libcef_dll/cef_logging.h"
|
|
||||||
|
|
||||||
|
|
||||||
// CefCppToC implementation for CefBase.
|
// CefCppToC implementation for CefBase.
|
||||||
class CefBaseCppToC : public CefBase {
|
class CefBaseCppToC : public CefBase {
|
||||||
@ -137,10 +137,11 @@ class CefBaseCppToC : public CefBase {
|
|||||||
return impl->class_->GetRefCt();
|
return impl->class_->GetRefCt();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
CefRefCount refct_;
|
CefRefCount refct_;
|
||||||
Struct struct_;
|
Struct struct_;
|
||||||
CefBase* class_;
|
CefBase* class_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefBaseCppToC);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_DLL_CPPTOC_BASE_CPPTOC_H_
|
#endif // CEF_LIBCEF_DLL_CPPTOC_BASE_CPPTOC_H_
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
#define CEF_LIBCEF_DLL_CPPTOC_CPPTOC_H_
|
#define CEF_LIBCEF_DLL_CPPTOC_CPPTOC_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "include/capi/cef_base_capi.h"
|
#include "include/capi/cef_base_capi.h"
|
||||||
#include "libcef_dll/cef_logging.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Wrap a C++ class with a C structure. This is used when the class
|
// Wrap a C++ class with a C structure. This is used when the class
|
||||||
@ -123,6 +124,11 @@ class CefCppToC : public CefBase {
|
|||||||
static long DebugObjCt; // NOLINT(runtime/int)
|
static long DebugObjCt; // NOLINT(runtime/int)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CefRefCount refct_;
|
||||||
|
Struct struct_;
|
||||||
|
BaseName* class_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int CEF_CALLBACK struct_add_ref(struct _cef_base_t* base) {
|
static int CEF_CALLBACK struct_add_ref(struct _cef_base_t* base) {
|
||||||
DCHECK(base);
|
DCHECK(base);
|
||||||
@ -151,10 +157,7 @@ class CefCppToC : public CefBase {
|
|||||||
return impl->class_->GetRefCt();
|
return impl->class_->GetRefCt();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
DISALLOW_COPY_AND_ASSIGN(CefCppToC);
|
||||||
CefRefCount refct_;
|
|
||||||
Struct struct_;
|
|
||||||
BaseName* class_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_DLL_CPPTOC_CPPTOC_H_
|
#endif // CEF_LIBCEF_DLL_CPPTOC_CPPTOC_H_
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
#define CEF_LIBCEF_DLL_CTOCPP_BASE_CTOCPP_H_
|
#define CEF_LIBCEF_DLL_CTOCPP_BASE_CTOCPP_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "include/capi/cef_base_capi.h"
|
#include "include/capi/cef_base_capi.h"
|
||||||
#include "libcef_dll/cef_logging.h"
|
|
||||||
|
|
||||||
|
|
||||||
// CefCToCpp implementation for CefBase.
|
// CefCToCpp implementation for CefBase.
|
||||||
@ -89,9 +90,11 @@ class CefBaseCToCpp : public CefBase {
|
|||||||
return struct_->get_refct(struct_);
|
return struct_->get_refct(struct_);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
CefRefCount refct_;
|
CefRefCount refct_;
|
||||||
cef_base_t* struct_;
|
cef_base_t* struct_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefBaseCToCpp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ CefRefPtr<CefCommandLine> CefCommandLine::CreateCommandLine() {
|
|||||||
const char* api_hash = cef_api_hash(0);
|
const char* api_hash = cef_api_hash(0);
|
||||||
if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
|
if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
|
||||||
// The libcef API hash does not match the current header API hash.
|
// The libcef API hash does not match the current header API hash.
|
||||||
DCHECK(false);
|
NOTREACHED();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ CefRefPtr<CefCommandLine> CefCommandLine::GetGlobalCommandLine() {
|
|||||||
const char* api_hash = cef_api_hash(0);
|
const char* api_hash = cef_api_hash(0);
|
||||||
if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
|
if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
|
||||||
// The libcef API hash does not match the current header API hash.
|
// The libcef API hash does not match the current header API hash.
|
||||||
DCHECK(false);
|
NOTREACHED();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
#define CEF_LIBCEF_DLL_CTOCPP_CTOCPP_H_
|
#define CEF_LIBCEF_DLL_CTOCPP_CTOCPP_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "include/capi/cef_base_capi.h"
|
#include "include/capi/cef_base_capi.h"
|
||||||
#include "libcef_dll/cef_logging.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Wrap a C structure with a C++ class. This is used when the implementation
|
// Wrap a C structure with a C++ class. This is used when the implementation
|
||||||
// exists on the other side of the DLL boundary but will have methods called on
|
// exists on the other side of the DLL boundary but will have methods called on
|
||||||
@ -108,6 +108,9 @@ class CefCToCpp : public BaseName {
|
|||||||
protected:
|
protected:
|
||||||
CefRefCount refct_;
|
CefRefCount refct_;
|
||||||
StructName* struct_;
|
StructName* struct_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefCToCpp);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_DLL_CTOCPP_CTOCPP_H_
|
#endif // CEF_LIBCEF_DLL_CTOCPP_CTOCPP_H_
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "include/cef_version.h"
|
#include "include/cef_version.h"
|
||||||
#include "cef_logging.h"
|
#include <cstddef>
|
||||||
|
|
||||||
CEF_EXPORT int cef_build_revision() {
|
CEF_EXPORT int cef_build_revision() {
|
||||||
return CEF_REVISION;
|
return CEF_REVISION;
|
||||||
|
@ -7,8 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "libcef_dll/cef_logging.h"
|
|
||||||
#include "libcef_dll/cef_macros.h"
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
|
|
||||||
// Default traits for CefBrowserInfoMap. Override to provide different object
|
// Default traits for CefBrowserInfoMap. Override to provide different object
|
||||||
// destruction behavior.
|
// destruction behavior.
|
||||||
@ -61,7 +62,7 @@ class CefBrowserInfoMap {
|
|||||||
} else {
|
} else {
|
||||||
info_map = it_browser->second;
|
info_map = it_browser->second;
|
||||||
// The specified ID should not already exist in the map.
|
// The specified ID should not already exist in the map.
|
||||||
DCHECK_EQ(info_map->find(info_id), info_map->end());
|
DCHECK(info_map->find(info_id) == info_map->end());
|
||||||
}
|
}
|
||||||
|
|
||||||
info_map->insert(std::make_pair(info_id, info));
|
info_map->insert(std::make_pair(info_id, info));
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "include/wrapper/cef_byte_read_handler.h"
|
#include "include/wrapper/cef_byte_read_handler.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "libcef_dll/cef_logging.h"
|
|
||||||
|
|
||||||
CefByteReadHandler::CefByteReadHandler(const unsigned char* bytes, size_t size,
|
CefByteReadHandler::CefByteReadHandler(const unsigned char* bytes, size_t size,
|
||||||
CefRefPtr<CefBase> source)
|
CefRefPtr<CefBase> source)
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_runnable.h"
|
#include "include/cef_runnable.h"
|
||||||
#include "include/cef_task.h"
|
#include "include/cef_task.h"
|
||||||
#include "libcef_dll/cef_logging.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "libcef_dll/cef_macros.h"
|
|
||||||
#include "libcef_dll/wrapper/cef_browser_info_map.h"
|
#include "libcef_dll/wrapper/cef_browser_info_map.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -3,12 +3,16 @@
|
|||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "include/wrapper/cef_stream_resource_handler.h"
|
#include "include/wrapper/cef_stream_resource_handler.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_callback.h"
|
#include "include/cef_callback.h"
|
||||||
#include "include/cef_request.h"
|
#include "include/cef_request.h"
|
||||||
#include "include/cef_runnable.h"
|
#include "include/cef_runnable.h"
|
||||||
#include "include/cef_stream.h"
|
#include "include/cef_stream.h"
|
||||||
#include "libcef_dll/cef_logging.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
// Class that represents a readable/writable character buffer.
|
// Class that represents a readable/writable character buffer.
|
||||||
class CefStreamResourceHandler::Buffer {
|
class CefStreamResourceHandler::Buffer {
|
||||||
@ -77,6 +81,8 @@ class CefStreamResourceHandler::Buffer {
|
|||||||
int bytes_requested_;
|
int bytes_requested_;
|
||||||
int bytes_written_;
|
int bytes_written_;
|
||||||
int bytes_read_;
|
int bytes_read_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(Buffer);
|
||||||
};
|
};
|
||||||
|
|
||||||
CefStreamResourceHandler::CefStreamResourceHandler(
|
CefStreamResourceHandler::CefStreamResourceHandler(
|
||||||
|
@ -3,10 +3,13 @@
|
|||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "include/wrapper/cef_xml_object.h"
|
#include "include/wrapper/cef_xml_object.h"
|
||||||
#include "include/cef_stream.h"
|
|
||||||
#include "libcef_dll/cef_logging.h"
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
|
#include "include/cef_stream.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class CefXmlObjectLoader {
|
class CefXmlObjectLoader {
|
||||||
@ -102,7 +105,7 @@ class CefXmlObjectLoader {
|
|||||||
cur_object->GetName() != reader->GetQualifiedName()) {
|
cur_object->GetName() != reader->GetQualifiedName()) {
|
||||||
// Open tag without close tag or close tag without open tag should
|
// Open tag without close tag or close tag without open tag should
|
||||||
// never occur (the parser catches this error).
|
// never occur (the parser catches this error).
|
||||||
DCHECK(false);
|
NOTREACHED();
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "Mismatched end tag for " <<
|
ss << "Mismatched end tag for " <<
|
||||||
std::string(cur_object->GetName()) <<
|
std::string(cur_object->GetName()) <<
|
||||||
@ -149,6 +152,8 @@ class CefXmlObjectLoader {
|
|||||||
private:
|
private:
|
||||||
CefString load_error_;
|
CefString load_error_;
|
||||||
CefRefPtr<CefXmlObject> root_object_;
|
CefRefPtr<CefXmlObject> root_object_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefXmlObjectLoader);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -2,17 +2,20 @@
|
|||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#if defined(__linux__)
|
#include "include/wrapper/cef_zip_archive.h"
|
||||||
#include <wctype.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "include/wrapper/cef_zip_archive.h"
|
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
#include "include/cef_stream.h"
|
#include "include/cef_stream.h"
|
||||||
#include "include/cef_zip_reader.h"
|
#include "include/cef_zip_reader.h"
|
||||||
#include "include/wrapper/cef_byte_read_handler.h"
|
#include "include/wrapper/cef_byte_read_handler.h"
|
||||||
#include "libcef_dll/cef_logging.h"
|
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
#include <wctype.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ CEF_GLOBAL int CefExecuteProcess(const CefMainArgs& args,
|
|||||||
const char* api_hash = cef_api_hash(0);
|
const char* api_hash = cef_api_hash(0);
|
||||||
if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
|
if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
|
||||||
// The libcef API hash does not match the current header API hash.
|
// The libcef API hash does not match the current header API hash.
|
||||||
DCHECK(false);
|
NOTREACHED();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ CEF_GLOBAL bool CefInitialize(const CefMainArgs& args,
|
|||||||
const char* api_hash = cef_api_hash(0);
|
const char* api_hash = cef_api_hash(0);
|
||||||
if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
|
if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
|
||||||
// The libcef API hash does not match the current header API hash.
|
// The libcef API hash does not match the current header API hash.
|
||||||
DCHECK(false);
|
NOTREACHED();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "cefclient/util.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
BytesWriteHandler::BytesWriteHandler(size_t grow)
|
BytesWriteHandler::BytesWriteHandler(size_t grow)
|
||||||
: grow_(grow),
|
: grow_(grow),
|
||||||
datasize_(grow),
|
datasize_(grow),
|
||||||
offset_(0) {
|
offset_(0) {
|
||||||
ASSERT(grow > 0); // NOLINT(readability/check)
|
DCHECK_GT(grow, 0U);
|
||||||
data_ = malloc(grow);
|
data_ = malloc(grow);
|
||||||
ASSERT(data_ != NULL);
|
DCHECK(data_ != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
BytesWriteHandler::~BytesWriteHandler() {
|
BytesWriteHandler::~BytesWriteHandler() {
|
||||||
@ -82,7 +82,7 @@ size_t BytesWriteHandler::Grow(size_t size) {
|
|||||||
size_t rv;
|
size_t rv;
|
||||||
size_t s = (size > grow_ ? size : grow_);
|
size_t s = (size > grow_ ? size : grow_);
|
||||||
void* tmp = realloc(data_, datasize_ + s);
|
void* tmp = realloc(data_, datasize_ + s);
|
||||||
ASSERT(tmp != NULL);
|
DCHECK(tmp != NULL);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
data_ = tmp;
|
data_ = tmp;
|
||||||
datasize_ += s;
|
datasize_ += s;
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "include/cef_runnable.h"
|
#include "include/cef_runnable.h"
|
||||||
#include "include/cef_web_plugin.h"
|
#include "include/cef_web_plugin.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
#include "cefclient/client_switches.h"
|
#include "cefclient/client_switches.h"
|
||||||
#include "cefclient/string_util.h"
|
#include "cefclient/string_util.h"
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
|
||||||
CefRefPtr<ClientHandler> g_handler;
|
CefRefPtr<ClientHandler> g_handler;
|
||||||
CefRefPtr<CefCommandLine> g_command_line;
|
CefRefPtr<CefCommandLine> g_command_line;
|
||||||
@ -49,7 +49,7 @@ CefRefPtr<CefCommandLine> AppGetCommandLine() {
|
|||||||
|
|
||||||
// Returns the application settings based on command line arguments.
|
// Returns the application settings based on command line arguments.
|
||||||
void AppGetSettings(CefSettings& settings) {
|
void AppGetSettings(CefSettings& settings) {
|
||||||
ASSERT(g_command_line.get());
|
DCHECK(g_command_line.get());
|
||||||
if (!g_command_line.get())
|
if (!g_command_line.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ void AppGetSettings(CefSettings& settings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AppGetBrowserSettings(CefBrowserSettings& settings) {
|
void AppGetBrowserSettings(CefBrowserSettings& settings) {
|
||||||
ASSERT(g_command_line.get());
|
DCHECK(g_command_line.get());
|
||||||
if (!g_command_line.get())
|
if (!g_command_line.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ void AppGetBrowserSettings(CefBrowserSettings& settings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AppIsOffScreenRenderingEnabled() {
|
bool AppIsOffScreenRenderingEnabled() {
|
||||||
ASSERT(g_command_line.get());
|
DCHECK(g_command_line.get());
|
||||||
if (!g_command_line.get())
|
if (!g_command_line.get())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "include/cef_runnable.h"
|
#include "include/cef_runnable.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "cefclient/cefclient_osr_widget_gtk.h"
|
#include "cefclient/cefclient_osr_widget_gtk.h"
|
||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
#include "cefclient/client_switches.h"
|
#include "cefclient/client_switches.h"
|
||||||
#include "cefclient/scheme_test.h"
|
#include "cefclient/scheme_test.h"
|
||||||
#include "cefclient/string_util.h"
|
#include "cefclient/string_util.h"
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
|
||||||
// The global ClientHandler reference.
|
// The global ClientHandler reference.
|
||||||
extern CefRefPtr<ClientHandler> g_handler;
|
extern CefRefPtr<ClientHandler> g_handler;
|
||||||
@ -318,7 +318,7 @@ GtkWidget* CreateMenuBar() {
|
|||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
// Create a copy of |argv| on Linux because Chromium mangles the value
|
// Create a copy of |argv| on Linux because Chromium mangles the value
|
||||||
// internally (see issue #620).
|
// internally (see issue #620).
|
||||||
ScopedArgArray scoped_arg_array(argc, argv);
|
CefScopedArgArray scoped_arg_array(argc, argv);
|
||||||
char** argv_copy = scoped_arg_array.array();
|
char** argv_copy = scoped_arg_array.array();
|
||||||
|
|
||||||
CefMainArgs main_args(argc, argv);
|
CefMainArgs main_args(argc, argv);
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "include/cef_runnable.h"
|
#include "include/cef_runnable.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "cefclient/bytes_write_handler.h"
|
#include "cefclient/bytes_write_handler.h"
|
||||||
#include "cefclient/cefclient_osr_widget_win.h"
|
#include "cefclient/cefclient_osr_widget_win.h"
|
||||||
#include "cefclient/resource.h"
|
#include "cefclient/resource.h"
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ void GetStorageForString(STGMEDIUM* stgmed, const std::basic_string<T>& data) {
|
|||||||
|
|
||||||
void GetStorageForFileDescriptor(STGMEDIUM* storage,
|
void GetStorageForFileDescriptor(STGMEDIUM* storage,
|
||||||
const std::wstring& file_name) {
|
const std::wstring& file_name) {
|
||||||
ASSERT(!file_name.empty());
|
DCHECK(!file_name.empty());
|
||||||
HANDLE hdata = GlobalAlloc(GPTR, sizeof(FILEGROUPDESCRIPTOR));
|
HANDLE hdata = GlobalAlloc(GPTR, sizeof(FILEGROUPDESCRIPTOR));
|
||||||
|
|
||||||
FILEGROUPDESCRIPTOR* descriptor =
|
FILEGROUPDESCRIPTOR* descriptor =
|
||||||
@ -252,7 +252,7 @@ bool DragDataToDataObject(CefRefPtr<CefDragData> drag_data,
|
|||||||
CefRefPtr<CefStreamWriter> writer =
|
CefRefPtr<CefStreamWriter> writer =
|
||||||
CefStreamWriter::CreateForHandler(handler.get());
|
CefStreamWriter::CreateForHandler(handler.get());
|
||||||
drag_data->GetFileContents(writer);
|
drag_data->GetFileContents(writer);
|
||||||
ASSERT(handler->GetDataSize() == static_cast<int64>(bufferSize));
|
DCHECK_EQ(handler->GetDataSize(), static_cast<int64>(bufferSize));
|
||||||
CefString fileName = drag_data->GetFileName();
|
CefString fileName = drag_data->GetFileName();
|
||||||
GetStorageForFileDescriptor(&stgmeds[curr_index], fileName.ToWString());
|
GetStorageForFileDescriptor(&stgmeds[curr_index], fileName.ToWString());
|
||||||
fmtetc.cfFormat = file_desc_format;
|
fmtetc.cfFormat = file_desc_format;
|
||||||
@ -264,7 +264,7 @@ bool DragDataToDataObject(CefRefPtr<CefDragData> drag_data,
|
|||||||
fmtetcs[curr_index] = fmtetc;
|
fmtetcs[curr_index] = fmtetc;
|
||||||
curr_index++;
|
curr_index++;
|
||||||
}
|
}
|
||||||
ASSERT(curr_index < kMaxDataObjects);
|
DCHECK_LT(curr_index, kMaxDataObjects);
|
||||||
|
|
||||||
CComPtr<IDataObject> obj =
|
CComPtr<IDataObject> obj =
|
||||||
DataObjectWin::Create(fmtetcs, stgmeds, curr_index);
|
DataObjectWin::Create(fmtetcs, stgmeds, curr_index);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <X11/Xcursor/Xcursor.h>
|
#include <X11/Xcursor/Xcursor.h>
|
||||||
|
|
||||||
#include "include/cef_runnable.h"
|
#include "include/cef_runnable.h"
|
||||||
#include "cefclient/util.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -1102,7 +1102,7 @@ class ScopedGLContext {
|
|||||||
CefRefPtr<OSRWindow> OSRWindow::Create(OSRBrowserProvider* browser_provider,
|
CefRefPtr<OSRWindow> OSRWindow::Create(OSRBrowserProvider* browser_provider,
|
||||||
bool transparent,
|
bool transparent,
|
||||||
ClientWindowHandle parentView) {
|
ClientWindowHandle parentView) {
|
||||||
ASSERT(browser_provider);
|
DCHECK(browser_provider);
|
||||||
if (!browser_provider)
|
if (!browser_provider)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -1198,7 +1198,7 @@ void OSRWindow::OnCursorChange(CefRefPtr<CefBrowser> browser,
|
|||||||
|
|
||||||
// Retrieve the X11 display shared with Chromium.
|
// Retrieve the X11 display shared with Chromium.
|
||||||
::Display* xdisplay = cef_get_xdisplay();
|
::Display* xdisplay = cef_get_xdisplay();
|
||||||
ASSERT(xdisplay);
|
DCHECK(xdisplay);
|
||||||
|
|
||||||
// Retrieve the X11 window handle for OSR widget.
|
// Retrieve the X11 window handle for OSR widget.
|
||||||
::Window xwindow = GDK_WINDOW_XID(gtk_widget_get_window(glarea_));
|
::Window xwindow = GDK_WINDOW_XID(gtk_widget_get_window(glarea_));
|
||||||
@ -1257,13 +1257,13 @@ OSRWindow::OSRWindow(OSRBrowserProvider* browser_provider,
|
|||||||
painting_popup_(false),
|
painting_popup_(false),
|
||||||
render_task_pending_(false) {
|
render_task_pending_(false) {
|
||||||
glarea_ = gtk_drawing_area_new();
|
glarea_ = gtk_drawing_area_new();
|
||||||
ASSERT(glarea_);
|
DCHECK(glarea_);
|
||||||
|
|
||||||
GdkGLConfig* glconfig = gdk_gl_config_new_by_mode(
|
GdkGLConfig* glconfig = gdk_gl_config_new_by_mode(
|
||||||
static_cast<GdkGLConfigMode>(GDK_GL_MODE_RGB |
|
static_cast<GdkGLConfigMode>(GDK_GL_MODE_RGB |
|
||||||
GDK_GL_MODE_DEPTH |
|
GDK_GL_MODE_DEPTH |
|
||||||
GDK_GL_MODE_DOUBLE));
|
GDK_GL_MODE_DOUBLE));
|
||||||
ASSERT(glconfig);
|
DCHECK(glconfig);
|
||||||
|
|
||||||
gtk_widget_set_gl_capability(glarea_, glconfig, NULL, TRUE,
|
gtk_widget_set_gl_capability(glarea_, glconfig, NULL, TRUE,
|
||||||
GDK_GL_RGBA_TYPE);
|
GDK_GL_RGBA_TYPE);
|
||||||
@ -1312,7 +1312,7 @@ OSRWindow::~OSRWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OSRWindow::Render() {
|
void OSRWindow::Render() {
|
||||||
ASSERT(CefCurrentlyOn(TID_UI));
|
CEF_REQUIRE_UI_THREAD();
|
||||||
if (render_task_pending_)
|
if (render_task_pending_)
|
||||||
render_task_pending_ = false;
|
render_task_pending_ = false;
|
||||||
|
|
||||||
@ -1327,7 +1327,7 @@ void OSRWindow::Render() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OSRWindow::EnableGL() {
|
void OSRWindow::EnableGL() {
|
||||||
ASSERT(CefCurrentlyOn(TID_UI));
|
CEF_REQUIRE_UI_THREAD();
|
||||||
if (gl_enabled_)
|
if (gl_enabled_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1341,7 +1341,7 @@ void OSRWindow::EnableGL() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OSRWindow::DisableGL() {
|
void OSRWindow::DisableGL() {
|
||||||
ASSERT(CefCurrentlyOn(TID_UI));
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (!gl_enabled_)
|
if (!gl_enabled_)
|
||||||
return;
|
return;
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_client.h"
|
#include "include/cef_client.h"
|
||||||
#include "include/cef_url.h"
|
#include "include/cef_url.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "cefclient/bytes_write_handler.h"
|
#include "cefclient/bytes_write_handler.h"
|
||||||
#include "cefclient/cefclient.h"
|
#include "cefclient/cefclient.h"
|
||||||
#include "cefclient/osrenderer.h"
|
#include "cefclient/osrenderer.h"
|
||||||
#include "cefclient/resource_util.h"
|
#include "cefclient/resource_util.h"
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
|
||||||
// This method will return YES for OS X versions 10.7.3 and later, and NO
|
// This method will return YES for OS X versions 10.7.3 and later, and NO
|
||||||
// otherwise.
|
// otherwise.
|
||||||
@ -127,7 +127,7 @@ void ClientOSRHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
|||||||
|
|
||||||
bool ClientOSRHandler::GetViewRect(CefRefPtr<CefBrowser> browser,
|
bool ClientOSRHandler::GetViewRect(CefRefPtr<CefBrowser> browser,
|
||||||
CefRect& rect) {
|
CefRect& rect) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (!view_)
|
if (!view_)
|
||||||
return false;
|
return false;
|
||||||
@ -146,7 +146,7 @@ bool ClientOSRHandler::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
|||||||
int viewY,
|
int viewY,
|
||||||
int& screenX,
|
int& screenX,
|
||||||
int& screenY) {
|
int& screenY) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (!view_)
|
if (!view_)
|
||||||
return false;
|
return false;
|
||||||
@ -163,7 +163,7 @@ bool ClientOSRHandler::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
|||||||
|
|
||||||
bool ClientOSRHandler::GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
bool ClientOSRHandler::GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
||||||
CefScreenInfo& screen_info) {
|
CefScreenInfo& screen_info) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (!view_)
|
if (!view_)
|
||||||
return false;
|
return false;
|
||||||
@ -192,7 +192,7 @@ bool ClientOSRHandler::GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
|||||||
|
|
||||||
void ClientOSRHandler::OnPopupShow(CefRefPtr<CefBrowser> browser,
|
void ClientOSRHandler::OnPopupShow(CefRefPtr<CefBrowser> browser,
|
||||||
bool show) {
|
bool show) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (!view_)
|
if (!view_)
|
||||||
return;
|
return;
|
||||||
@ -209,7 +209,7 @@ void ClientOSRHandler::OnPopupShow(CefRefPtr<CefBrowser> browser,
|
|||||||
|
|
||||||
void ClientOSRHandler::OnPopupSize(CefRefPtr<CefBrowser> browser,
|
void ClientOSRHandler::OnPopupSize(CefRefPtr<CefBrowser> browser,
|
||||||
const CefRect& rect) {
|
const CefRect& rect) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (!view_)
|
if (!view_)
|
||||||
return;
|
return;
|
||||||
@ -222,7 +222,7 @@ void ClientOSRHandler::OnPaint(CefRefPtr<CefBrowser> browser,
|
|||||||
const RectList& dirtyRects,
|
const RectList& dirtyRects,
|
||||||
const void* buffer,
|
const void* buffer,
|
||||||
int width, int height) {
|
int width, int height) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (!view_)
|
if (!view_)
|
||||||
return;
|
return;
|
||||||
@ -253,7 +253,7 @@ void ClientOSRHandler::OnPaint(CefRefPtr<CefBrowser> browser,
|
|||||||
|
|
||||||
void ClientOSRHandler::OnCursorChange(CefRefPtr<CefBrowser> browser,
|
void ClientOSRHandler::OnCursorChange(CefRefPtr<CefBrowser> browser,
|
||||||
CefCursorHandle cursor) {
|
CefCursorHandle cursor) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
[cursor set];
|
[cursor set];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ bool ClientOSRHandler::StartDragging(CefRefPtr<CefBrowser> browser,
|
|||||||
CefRefPtr<CefDragData> drag_data,
|
CefRefPtr<CefDragData> drag_data,
|
||||||
CefRenderHandler::DragOperationsMask allowed_ops,
|
CefRenderHandler::DragOperationsMask allowed_ops,
|
||||||
int x, int y) {
|
int x, int y) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
if (!view_)
|
if (!view_)
|
||||||
return false;
|
return false;
|
||||||
return [view_ startDragging:drag_data
|
return [view_ startDragging:drag_data
|
||||||
@ -271,7 +271,7 @@ bool ClientOSRHandler::StartDragging(CefRefPtr<CefBrowser> browser,
|
|||||||
|
|
||||||
void ClientOSRHandler::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
|
void ClientOSRHandler::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
|
||||||
CefRenderHandler::DragOperation operation) {
|
CefRenderHandler::DragOperation operation) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
if (!view_)
|
if (!view_)
|
||||||
return;
|
return;
|
||||||
view_->current_drag_op_ = operation;
|
view_->current_drag_op_ = operation;
|
||||||
@ -542,7 +542,7 @@ void ClientOSRHandler::SetLoading(bool isLoading) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
CGEventRef cgEvent = [event CGEvent];
|
CGEventRef cgEvent = [event CGEvent];
|
||||||
ASSERT(cgEvent);
|
DCHECK(cgEvent);
|
||||||
|
|
||||||
int deltaX =
|
int deltaX =
|
||||||
CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis2);
|
CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis2);
|
||||||
@ -817,9 +817,9 @@ void ClientOSRHandler::SetLoading(bool isLoading) {
|
|||||||
- (BOOL)startDragging:(CefRefPtr<CefDragData>)drag_data
|
- (BOOL)startDragging:(CefRefPtr<CefDragData>)drag_data
|
||||||
allowed_ops:(NSDragOperation)ops
|
allowed_ops:(NSDragOperation)ops
|
||||||
point:(NSPoint)position {
|
point:(NSPoint)position {
|
||||||
ASSERT(!pasteboard_);
|
DCHECK(!pasteboard_);
|
||||||
ASSERT(!fileUTI_);
|
DCHECK(!fileUTI_);
|
||||||
ASSERT(!current_drag_data_.get());
|
DCHECK(!current_drag_data_.get());
|
||||||
|
|
||||||
[self resetDragDrop];
|
[self resetDragDrop];
|
||||||
|
|
||||||
@ -982,7 +982,7 @@ void ClientOSRHandler::SetLoading(bool isLoading) {
|
|||||||
|
|
||||||
// URL.
|
// URL.
|
||||||
if ([type isEqualToString:NSURLPboardType]) {
|
if ([type isEqualToString:NSURLPboardType]) {
|
||||||
ASSERT(current_drag_data_->IsLink());
|
DCHECK(current_drag_data_->IsLink());
|
||||||
NSString* strUrl = [NSString stringWithUTF8String:
|
NSString* strUrl = [NSString stringWithUTF8String:
|
||||||
current_drag_data_->GetLinkURL().ToString().c_str()];
|
current_drag_data_->GetLinkURL().ToString().c_str()];
|
||||||
NSURL* url = [NSURL URLWithString:strUrl];
|
NSURL* url = [NSURL URLWithString:strUrl];
|
||||||
@ -996,12 +996,12 @@ void ClientOSRHandler::SetLoading(bool isLoading) {
|
|||||||
// File contents.
|
// File contents.
|
||||||
} else if ([type isEqualToString:(NSString*)fileUTI_]) {
|
} else if ([type isEqualToString:(NSString*)fileUTI_]) {
|
||||||
size_t size = current_drag_data_->GetFileContents(NULL);
|
size_t size = current_drag_data_->GetFileContents(NULL);
|
||||||
ASSERT(size > 0);
|
DCHECK_GT(size, 0U);
|
||||||
CefRefPtr<BytesWriteHandler> handler = new BytesWriteHandler(size);
|
CefRefPtr<BytesWriteHandler> handler = new BytesWriteHandler(size);
|
||||||
CefRefPtr<CefStreamWriter> writer =
|
CefRefPtr<CefStreamWriter> writer =
|
||||||
CefStreamWriter::CreateForHandler(handler.get());
|
CefStreamWriter::CreateForHandler(handler.get());
|
||||||
current_drag_data_->GetFileContents(writer);
|
current_drag_data_->GetFileContents(writer);
|
||||||
ASSERT(handler->GetDataSize() == static_cast<int64>(size));
|
DCHECK_EQ(handler->GetDataSize(), static_cast<int64>(size));
|
||||||
|
|
||||||
[pboard setData:[NSData dataWithBytes:handler->GetData()
|
[pboard setData:[NSData dataWithBytes:handler->GetData()
|
||||||
length:handler->GetDataSize()]
|
length:handler->GetDataSize()]
|
||||||
@ -1038,7 +1038,7 @@ void ClientOSRHandler::SetLoading(bool isLoading) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)fillPasteboard {
|
- (void)fillPasteboard {
|
||||||
ASSERT(!pasteboard_);
|
DCHECK(!pasteboard_);
|
||||||
pasteboard_ = [[NSPasteboard pasteboardWithName:NSDragPboard] retain];
|
pasteboard_ = [[NSPasteboard pasteboardWithName:NSDragPboard] retain];
|
||||||
|
|
||||||
[pasteboard_ declareTypes:@[ kCEFDragDummyPboardType ]
|
[pasteboard_ declareTypes:@[ kCEFDragDummyPboardType ]
|
||||||
@ -1090,9 +1090,9 @@ void ClientOSRHandler::SetLoading(bool isLoading) {
|
|||||||
|
|
||||||
- (void)populateDropData:(CefRefPtr<CefDragData>)data
|
- (void)populateDropData:(CefRefPtr<CefDragData>)data
|
||||||
fromPasteboard:(NSPasteboard*)pboard {
|
fromPasteboard:(NSPasteboard*)pboard {
|
||||||
ASSERT(data);
|
DCHECK(data);
|
||||||
ASSERT(pboard);
|
DCHECK(pboard);
|
||||||
ASSERT(data && !data->IsReadOnly());
|
DCHECK(data && !data->IsReadOnly());
|
||||||
NSArray* types = [pboard types];
|
NSArray* types = [pboard types];
|
||||||
|
|
||||||
// Get plain text.
|
// Get plain text.
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
#include "include/cef_runnable.h"
|
#include "include/cef_runnable.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "cefclient/resource.h"
|
#include "cefclient/resource.h"
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
CefRefPtr<OSRWindow> OSRWindow::Create(OSRBrowserProvider* browser_provider,
|
CefRefPtr<OSRWindow> OSRWindow::Create(OSRBrowserProvider* browser_provider,
|
||||||
bool transparent) {
|
bool transparent) {
|
||||||
ASSERT(browser_provider);
|
DCHECK(browser_provider);
|
||||||
if (!browser_provider)
|
if (!browser_provider)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ CefRefPtr<OSRWindow> OSRWindow::From(
|
|||||||
|
|
||||||
bool OSRWindow::CreateWidget(HWND hWndParent, const RECT& rect,
|
bool OSRWindow::CreateWidget(HWND hWndParent, const RECT& rect,
|
||||||
HINSTANCE hInst, LPCTSTR className) {
|
HINSTANCE hInst, LPCTSTR className) {
|
||||||
ASSERT(hWnd_ == NULL && hDC_ == NULL && hRC_ == NULL);
|
DCHECK(hWnd_ == NULL && hDC_ == NULL && hRC_ == NULL);
|
||||||
|
|
||||||
RegisterOSRClass(hInst, className);
|
RegisterOSRClass(hInst, className);
|
||||||
hWnd_ = ::CreateWindow(className, 0,
|
hWnd_ = ::CreateWindow(className, 0,
|
||||||
@ -46,7 +46,7 @@ bool OSRWindow::CreateWidget(HWND hWndParent, const RECT& rect,
|
|||||||
|
|
||||||
drop_target_ = DropTargetWin::Create(this, hWnd_);
|
drop_target_ = DropTargetWin::Create(this, hWnd_);
|
||||||
HRESULT register_res = RegisterDragDrop(hWnd_, drop_target_);
|
HRESULT register_res = RegisterDragDrop(hWnd_, drop_target_);
|
||||||
ASSERT(register_res == S_OK);
|
DCHECK_EQ(register_res, S_OK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ OSRWindow::~OSRWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OSRWindow::Render() {
|
void OSRWindow::Render() {
|
||||||
ASSERT(CefCurrentlyOn(TID_UI));
|
CEF_REQUIRE_UI_THREAD();
|
||||||
if (render_task_pending_)
|
if (render_task_pending_)
|
||||||
render_task_pending_ = false;
|
render_task_pending_ = false;
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ void OSRWindow::Render() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OSRWindow::EnableGL() {
|
void OSRWindow::EnableGL() {
|
||||||
ASSERT(CefCurrentlyOn(TID_UI));
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
int format;
|
int format;
|
||||||
@ -277,7 +277,7 @@ void OSRWindow::EnableGL() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OSRWindow::DisableGL() {
|
void OSRWindow::DisableGL() {
|
||||||
ASSERT(CefCurrentlyOn(TID_UI));
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (!hDC_)
|
if (!hDC_)
|
||||||
return;
|
return;
|
||||||
|
@ -143,7 +143,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||||||
} else {
|
} else {
|
||||||
// Create a hidden window for message processing.
|
// Create a hidden window for message processing.
|
||||||
hMessageWnd = CreateMessageWindow(hInstance);
|
hMessageWnd = CreateMessageWindow(hInstance);
|
||||||
ASSERT(hMessageWnd);
|
DCHECK(hMessageWnd);
|
||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
@ -692,7 +692,7 @@ void AppQuitMessageLoop() {
|
|||||||
if (command_line->HasSwitch(cefclient::kMultiThreadedMessageLoop)) {
|
if (command_line->HasSwitch(cefclient::kMultiThreadedMessageLoop)) {
|
||||||
// Running in multi-threaded message loop mode. Need to execute
|
// Running in multi-threaded message loop mode. Need to execute
|
||||||
// PostQuitMessage on the main application thread.
|
// PostQuitMessage on the main application thread.
|
||||||
ASSERT(hMessageWnd);
|
DCHECK(hMessageWnd);
|
||||||
PostMessage(hMessageWnd, WM_COMMAND, ID_QUIT, 0);
|
PostMessage(hMessageWnd, WM_COMMAND, ID_QUIT, 0);
|
||||||
} else {
|
} else {
|
||||||
CefQuitMessageLoop();
|
CefQuitMessageLoop();
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "include/cef_process_message.h"
|
#include "include/cef_process_message.h"
|
||||||
#include "include/cef_task.h"
|
#include "include/cef_task.h"
|
||||||
#include "include/cef_v8.h"
|
#include "include/cef_v8.h"
|
||||||
#include "util.h" // NOLINT(build/include)
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
ClientApp::ClientApp() {
|
ClientApp::ClientApp() {
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ void ClientApp::OnContextInitialized() {
|
|||||||
|
|
||||||
// Register cookieable schemes with the global cookie manager.
|
// Register cookieable schemes with the global cookie manager.
|
||||||
CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager();
|
CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager();
|
||||||
ASSERT(manager.get());
|
DCHECK(manager.get());
|
||||||
manager->SetSupportedSchemes(cookieable_schemes_);
|
manager->SetSupportedSchemes(cookieable_schemes_);
|
||||||
|
|
||||||
print_handler_ = CreatePrintHandler();
|
print_handler_ = CreatePrintHandler();
|
||||||
@ -146,7 +146,7 @@ bool ClientApp::OnProcessMessageReceived(
|
|||||||
CefRefPtr<CefBrowser> browser,
|
CefRefPtr<CefBrowser> browser,
|
||||||
CefProcessId source_process,
|
CefProcessId source_process,
|
||||||
CefRefPtr<CefProcessMessage> message) {
|
CefRefPtr<CefProcessMessage> message) {
|
||||||
ASSERT(source_process == PID_BROWSER);
|
DCHECK_EQ(source_process, PID_BROWSER);
|
||||||
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
|||||||
const CefString& message,
|
const CefString& message,
|
||||||
const CefString& source,
|
const CefString& source,
|
||||||
int line) {
|
int line) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
bool first_message;
|
bool first_message;
|
||||||
std::string logFile;
|
std::string logFile;
|
||||||
@ -239,7 +239,7 @@ void ClientHandler::OnBeforeDownload(
|
|||||||
CefRefPtr<CefDownloadItem> download_item,
|
CefRefPtr<CefDownloadItem> download_item,
|
||||||
const CefString& suggested_name,
|
const CefString& suggested_name,
|
||||||
CefRefPtr<CefBeforeDownloadCallback> callback) {
|
CefRefPtr<CefBeforeDownloadCallback> callback) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
// Continue the download and show the "Save As" dialog.
|
// Continue the download and show the "Save As" dialog.
|
||||||
callback->Continue(GetDownloadPath(suggested_name), true);
|
callback->Continue(GetDownloadPath(suggested_name), true);
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ void ClientHandler::OnDownloadUpdated(
|
|||||||
CefRefPtr<CefBrowser> browser,
|
CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefDownloadItem> download_item,
|
CefRefPtr<CefDownloadItem> download_item,
|
||||||
CefRefPtr<CefDownloadItemCallback> callback) {
|
CefRefPtr<CefDownloadItemCallback> callback) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
if (download_item->IsComplete()) {
|
if (download_item->IsComplete()) {
|
||||||
SetLastDownloadFile(download_item->GetFullPath());
|
SetLastDownloadFile(download_item->GetFullPath());
|
||||||
SendNotification(NOTIFY_DOWNLOAD_COMPLETE);
|
SendNotification(NOTIFY_DOWNLOAD_COMPLETE);
|
||||||
@ -258,7 +258,7 @@ void ClientHandler::OnDownloadUpdated(
|
|||||||
bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
|
bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefDragData> dragData,
|
CefRefPtr<CefDragData> dragData,
|
||||||
CefDragHandler::DragOperationsMask mask) {
|
CefDragHandler::DragOperationsMask mask) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Forbid dragging of link URLs.
|
// Forbid dragging of link URLs.
|
||||||
if (mask & DRAG_OPERATION_LINK)
|
if (mask & DRAG_OPERATION_LINK)
|
||||||
@ -340,7 +340,7 @@ bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> browser,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (!message_router_) {
|
if (!message_router_) {
|
||||||
// Create the browser-side router for query handling.
|
// Create the browser-side router for query handling.
|
||||||
@ -378,7 +378,7 @@ void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Closing the main window requires special handling. See the DoClose()
|
// Closing the main window requires special handling. See the DoClose()
|
||||||
// documentation in the CEF header for a detailed destription of this
|
// documentation in the CEF header for a detailed destription of this
|
||||||
@ -394,7 +394,7 @@ bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
void ClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
message_router_->OnBeforeClose(browser);
|
message_router_->OnBeforeClose(browser);
|
||||||
|
|
||||||
@ -437,7 +437,7 @@ void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
|||||||
bool isLoading,
|
bool isLoading,
|
||||||
bool canGoBack,
|
bool canGoBack,
|
||||||
bool canGoForward) {
|
bool canGoForward) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
SetLoading(isLoading);
|
SetLoading(isLoading);
|
||||||
SetNavState(canGoBack, canGoForward);
|
SetNavState(canGoBack, canGoForward);
|
||||||
@ -454,7 +454,7 @@ void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
|||||||
ErrorCode errorCode,
|
ErrorCode errorCode,
|
||||||
const CefString& errorText,
|
const CefString& errorText,
|
||||||
const CefString& failedUrl) {
|
const CefString& failedUrl) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Don't display an error for downloaded files.
|
// Don't display an error for downloaded files.
|
||||||
if (errorCode == ERR_ABORTED)
|
if (errorCode == ERR_ABORTED)
|
||||||
@ -504,7 +504,7 @@ CefRefPtr<CefResourceHandler> ClientHandler::GetResourceHandler(
|
|||||||
CefStreamReader::CreateForData(
|
CefStreamReader::CreateForData(
|
||||||
static_cast<void*>(const_cast<char*>(str.c_str())),
|
static_cast<void*>(const_cast<char*>(str.c_str())),
|
||||||
str.size());
|
str.size());
|
||||||
ASSERT(stream.get());
|
DCHECK(stream.get());
|
||||||
return new CefStreamResourceHandler("text/html", stream);
|
return new CefStreamResourceHandler("text/html", stream);
|
||||||
} else {
|
} else {
|
||||||
// Load the resource from file.
|
// Load the resource from file.
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "include/cef_client.h"
|
#include "include/cef_client.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "include/wrapper/cef_message_router.h"
|
#include "include/wrapper/cef_message_router.h"
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
// The Linux client uses GTK instead of the underlying platform type (X11).
|
// The Linux client uses GTK instead of the underlying platform type (X11).
|
||||||
|
@ -127,7 +127,7 @@ bool ClientHandler::OnFileDialog(CefRefPtr<CefBrowser> browser,
|
|||||||
action = GTK_FILE_CHOOSER_ACTION_SAVE;
|
action = GTK_FILE_CHOOSER_ACTION_SAVE;
|
||||||
accept_button = GTK_STOCK_SAVE;
|
accept_button = GTK_STOCK_SAVE;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(false); // Not reached
|
NOTREACHED();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ bool ClientHandler::OnFileDialog(CefRefPtr<CefBrowser> browser,
|
|||||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
const CefString& url) {
|
const CefString& url) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||||
// Set the edit window text
|
// Set the edit window text
|
||||||
@ -227,7 +227,7 @@ void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
|||||||
|
|
||||||
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& title) {
|
const CefString& title) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
std::string titleStr(title);
|
std::string titleStr(title);
|
||||||
|
|
||||||
@ -239,11 +239,11 @@ void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
|||||||
} else {
|
} else {
|
||||||
// Retrieve the X11 display shared with Chromium.
|
// Retrieve the X11 display shared with Chromium.
|
||||||
::Display* display = cef_get_xdisplay();
|
::Display* display = cef_get_xdisplay();
|
||||||
ASSERT(display);
|
DCHECK(display);
|
||||||
|
|
||||||
// Retrieve the X11 window handle for the browser.
|
// Retrieve the X11 window handle for the browser.
|
||||||
::Window window = browser->GetHost()->GetWindowHandle();
|
::Window window = browser->GetHost()->GetWindowHandle();
|
||||||
ASSERT(window != kNullWindowHandle);
|
DCHECK_NE(window, kNullWindowHandle);
|
||||||
|
|
||||||
// Retrieve the atoms required by the below XChangeProperty call.
|
// Retrieve the atoms required by the below XChangeProperty call.
|
||||||
const char* kAtoms[] = {
|
const char* kAtoms[] = {
|
||||||
@ -254,7 +254,7 @@ void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
|||||||
int result = XInternAtoms(display, const_cast<char**>(kAtoms), 2, false,
|
int result = XInternAtoms(display, const_cast<char**>(kAtoms), 2, false,
|
||||||
atoms);
|
atoms);
|
||||||
if (!result)
|
if (!result)
|
||||||
ASSERT(false);
|
NOTREACHED();
|
||||||
|
|
||||||
// Set the window title.
|
// Set the window title.
|
||||||
XChangeProperty(display,
|
XChangeProperty(display,
|
||||||
@ -379,7 +379,7 @@ void ClientHandler::OnResetDialogState(CefRefPtr<CefBrowser> browser) {
|
|||||||
void ClientHandler::OnDialogResponse(GtkDialog* dialog,
|
void ClientHandler::OnDialogResponse(GtkDialog* dialog,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
ClientHandler* handler) {
|
ClientHandler* handler) {
|
||||||
ASSERT(dialog == GTK_DIALOG(handler->gtk_dialog_));
|
DCHECK_EQ(dialog, GTK_DIALOG(handler->gtk_dialog_));
|
||||||
switch (response_id) {
|
switch (response_id) {
|
||||||
case GTK_RESPONSE_OK:
|
case GTK_RESPONSE_OK:
|
||||||
handler->js_dialog_callback_->Continue(true, GetPromptText(dialog));
|
handler->js_dialog_callback_->Continue(true, GetPromptText(dialog));
|
||||||
@ -389,7 +389,7 @@ void ClientHandler::OnDialogResponse(GtkDialog* dialog,
|
|||||||
handler->js_dialog_callback_->Continue(false, CefString());
|
handler->js_dialog_callback_->Continue(false, CefString());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(false); // Not reached
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
handler->OnResetDialogState(NULL);
|
handler->OnResetDialogState(NULL);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
const CefString& url) {
|
const CefString& url) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||||
// Set the edit window text
|
// Set the edit window text
|
||||||
@ -25,7 +25,7 @@ void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
|||||||
|
|
||||||
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& title) {
|
const CefString& title) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Set the frame window title bar
|
// Set the frame window title bar
|
||||||
NSView* view = (NSView*)browser->GetHost()->GetWindowHandle();
|
NSView* view = (NSView*)browser->GetHost()->GetWindowHandle();
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
const CefString& url) {
|
const CefString& url) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||||
// Set the edit window text
|
// Set the edit window text
|
||||||
@ -25,7 +25,7 @@ void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
|||||||
|
|
||||||
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& title) {
|
const CefString& title) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Set the frame window title bar
|
// Set the frame window title bar
|
||||||
CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();
|
CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();
|
||||||
@ -55,14 +55,14 @@ void ClientHandler::SendNotification(NotificationType type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClientHandler::SetLoading(bool isLoading) {
|
void ClientHandler::SetLoading(bool isLoading) {
|
||||||
ASSERT(m_EditHwnd != NULL && m_ReloadHwnd != NULL && m_StopHwnd != NULL);
|
DCHECK(m_EditHwnd != NULL && m_ReloadHwnd != NULL && m_StopHwnd != NULL);
|
||||||
EnableWindow(m_EditHwnd, TRUE);
|
EnableWindow(m_EditHwnd, TRUE);
|
||||||
EnableWindow(m_ReloadHwnd, !isLoading);
|
EnableWindow(m_ReloadHwnd, !isLoading);
|
||||||
EnableWindow(m_StopHwnd, isLoading);
|
EnableWindow(m_StopHwnd, isLoading);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
|
void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
|
||||||
ASSERT(m_BackHwnd != NULL && m_ForwardHwnd != NULL);
|
DCHECK(m_BackHwnd != NULL && m_ForwardHwnd != NULL);
|
||||||
EnableWindow(m_BackHwnd, canGoBack);
|
EnableWindow(m_BackHwnd, canGoBack);
|
||||||
EnableWindow(m_ForwardHwnd, canGoForward);
|
EnableWindow(m_ForwardHwnd, canGoForward);
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "include/cef_dom.h"
|
#include "include/cef_dom.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "include/wrapper/cef_message_router.h"
|
#include "include/wrapper/cef_message_router.h"
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
|
||||||
namespace client_renderer {
|
namespace client_renderer {
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
browser->GetHost()->RunFileDialog(FILE_DIALOG_SAVE, "My Save Dialog",
|
browser->GetHost()->RunFileDialog(FILE_DIALOG_SAVE, "My Save Dialog",
|
||||||
"test.txt", file_types, dialog_callback.get());
|
"test.txt", file_types, dialog_callback.get());
|
||||||
} else {
|
} else {
|
||||||
ASSERT(false); // Not reached.
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "include/cef_dom.h"
|
#include "include/cef_dom.h"
|
||||||
#include "cefclient/util.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
namespace dom_test {
|
namespace dom_test {
|
||||||
|
|
||||||
@ -25,12 +25,12 @@ class ClientDOMEventListener : public CefDOMEventListener {
|
|||||||
|
|
||||||
virtual void HandleEvent(CefRefPtr<CefDOMEvent> event) OVERRIDE {
|
virtual void HandleEvent(CefRefPtr<CefDOMEvent> event) OVERRIDE {
|
||||||
CefRefPtr<CefDOMDocument> document = event->GetDocument();
|
CefRefPtr<CefDOMDocument> document = event->GetDocument();
|
||||||
ASSERT(document.get());
|
DCHECK(document.get());
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
||||||
CefRefPtr<CefDOMNode> button = event->GetTarget();
|
CefRefPtr<CefDOMNode> button = event->GetTarget();
|
||||||
ASSERT(button.get());
|
DCHECK(button.get());
|
||||||
std::string buttonValue = button->GetElementAttribute("value");
|
std::string buttonValue = button->GetElementAttribute("value");
|
||||||
ss << "You clicked the " << buttonValue.c_str() << " button. ";
|
ss << "You clicked the " << buttonValue.c_str() << " button. ";
|
||||||
|
|
||||||
@ -71,10 +71,10 @@ class ClientDOMEventListener : public CefDOMEventListener {
|
|||||||
|
|
||||||
// Update the description.
|
// Update the description.
|
||||||
CefRefPtr<CefDOMNode> desc = document->GetElementById("description");
|
CefRefPtr<CefDOMNode> desc = document->GetElementById("description");
|
||||||
ASSERT(desc.get());
|
DCHECK(desc.get());
|
||||||
CefRefPtr<CefDOMNode> text = desc->GetFirstChild();
|
CefRefPtr<CefDOMNode> text = desc->GetFirstChild();
|
||||||
ASSERT(text.get());
|
DCHECK(text.get());
|
||||||
ASSERT(text->IsText());
|
DCHECK(text->IsText());
|
||||||
text->SetValue(ss.str());
|
text->SetValue(ss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ class ClientDOMVisitor : public CefDOMVisitor {
|
|||||||
virtual void Visit(CefRefPtr<CefDOMDocument> document) OVERRIDE {
|
virtual void Visit(CefRefPtr<CefDOMDocument> document) OVERRIDE {
|
||||||
// Register a click listener for the button.
|
// Register a click listener for the button.
|
||||||
CefRefPtr<CefDOMNode> button = document->GetElementById("button");
|
CefRefPtr<CefDOMNode> button = document->GetElementById("button");
|
||||||
ASSERT(button.get());
|
DCHECK(button.get());
|
||||||
button->AddEventListener("click", new ClientDOMEventListener(), false);
|
button->AddEventListener("click", new ClientDOMEventListener(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#error Platform is not supported.
|
#error Platform is not supported.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cefclient/util.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
#ifndef GL_BGR
|
#ifndef GL_BGR
|
||||||
#define GL_BGR 0x80E0
|
#define GL_BGR 0x80E0
|
||||||
@ -56,7 +56,7 @@ void ClientOSRenderer::Initialize() {
|
|||||||
|
|
||||||
// Create the texture.
|
// Create the texture.
|
||||||
glGenTextures(1, &texture_id_);
|
glGenTextures(1, &texture_id_);
|
||||||
ASSERT(texture_id_ != 0);
|
DCHECK_NE(texture_id_, 0U);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, texture_id_);
|
glBindTexture(GL_TEXTURE_2D, texture_id_);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
@ -75,7 +75,7 @@ void ClientOSRenderer::Render() {
|
|||||||
if (view_width_ == 0 || view_height_ == 0)
|
if (view_width_ == 0 || view_height_ == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT(initialized_);
|
DCHECK(initialized_);
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
float tu, tv;
|
float tu, tv;
|
||||||
@ -128,7 +128,7 @@ void ClientOSRenderer::Render() {
|
|||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
// Draw the facets with the texture.
|
// Draw the facets with the texture.
|
||||||
ASSERT(texture_id_ != 0);
|
DCHECK_NE(texture_id_, 0U);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture_id_);
|
glBindTexture(GL_TEXTURE_2D, texture_id_);
|
||||||
glInterleavedArrays(GL_T2F_V3F, 0, vertices);
|
glInterleavedArrays(GL_T2F_V3F, 0, vertices);
|
||||||
glDrawArrays(GL_QUADS, 0, 4);
|
glDrawArrays(GL_QUADS, 0, 4);
|
||||||
@ -198,7 +198,7 @@ void ClientOSRenderer::OnPaint(CefRefPtr<CefBrowser> browser,
|
|||||||
// Enable 2D textures.
|
// Enable 2D textures.
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
ASSERT(texture_id_ != 0);
|
DCHECK_NE(texture_id_, 0U);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture_id_);
|
glBindTexture(GL_TEXTURE_2D, texture_id_);
|
||||||
|
|
||||||
if (type == PET_VIEW) {
|
if (type == PET_VIEW) {
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
#define CEF_TESTS_CEFCLIENT_PERFORMANCE_TEST_SETUP_H_
|
#define CEF_TESTS_CEFCLIENT_PERFORMANCE_TEST_SETUP_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cefclient/util.h"
|
#include "include/base/cef_macros.h"
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
|
||||||
namespace performance_test {
|
namespace performance_test {
|
||||||
|
|
||||||
@ -39,19 +40,19 @@ class CefTimer {
|
|||||||
bool IsRunning() { return running_; }
|
bool IsRunning() { return running_; }
|
||||||
|
|
||||||
void Start() {
|
void Start() {
|
||||||
ASSERT(!running_);
|
DCHECK(!running_);
|
||||||
running_ = true;
|
running_ = true;
|
||||||
start_.Now();
|
start_.Now();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stop() {
|
void Stop() {
|
||||||
stop_.Now();
|
stop_.Now();
|
||||||
ASSERT(running_);
|
DCHECK(running_);
|
||||||
running_ = false;
|
running_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64 Delta() {
|
int64 Delta() {
|
||||||
ASSERT(!running_);
|
DCHECK(!running_);
|
||||||
return start_.Delta(stop_);
|
return start_.Delta(stop_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +60,8 @@ class CefTimer {
|
|||||||
bool running_;
|
bool running_;
|
||||||
CefTime start_;
|
CefTime start_;
|
||||||
CefTime stop_;
|
CefTime stop_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefTimer);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Peform test iterations using a user-provided timing result variable.
|
// Peform test iterations using a user-provided timing result variable.
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "cefclient/util.h"
|
#include "include/base/cef_logging.h"
|
||||||
|
#include "include/base/cef_macros.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -57,7 +59,7 @@ class StickyPrintSettingGtk {
|
|||||||
StickyPrintSettingGtk() : last_used_settings_(gtk_print_settings_new()) {
|
StickyPrintSettingGtk() : last_used_settings_(gtk_print_settings_new()) {
|
||||||
}
|
}
|
||||||
~StickyPrintSettingGtk() {
|
~StickyPrintSettingGtk() {
|
||||||
ASSERT(false); // Not reached; the instance is leaked.
|
NOTREACHED(); // The instance is intentionally leaked.
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkPrintSettings* settings() {
|
GtkPrintSettings* settings() {
|
||||||
@ -65,7 +67,7 @@ class StickyPrintSettingGtk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetLastUsedSettings(GtkPrintSettings* settings) {
|
void SetLastUsedSettings(GtkPrintSettings* settings) {
|
||||||
ASSERT(last_used_settings_);
|
DCHECK(last_used_settings_);
|
||||||
g_object_unref(last_used_settings_);
|
g_object_unref(last_used_settings_);
|
||||||
last_used_settings_ = gtk_print_settings_copy(settings);
|
last_used_settings_ = gtk_print_settings_copy(settings);
|
||||||
}
|
}
|
||||||
@ -215,8 +217,8 @@ void GetColorModelForMode(CefPrintSettings::ColorModel color_mode,
|
|||||||
void InitPrintSettings(GtkPrintSettings* settings,
|
void InitPrintSettings(GtkPrintSettings* settings,
|
||||||
GtkPageSetup* page_setup,
|
GtkPageSetup* page_setup,
|
||||||
CefRefPtr<CefPrintSettings> print_settings) {
|
CefRefPtr<CefPrintSettings> print_settings) {
|
||||||
ASSERT(settings);
|
DCHECK(settings);
|
||||||
ASSERT(page_setup);
|
DCHECK(page_setup);
|
||||||
|
|
||||||
std::string device_name;
|
std::string device_name;
|
||||||
const gchar* name = gtk_print_settings_get_printer(settings);
|
const gchar* name = gtk_print_settings_get_printer(settings);
|
||||||
@ -283,8 +285,8 @@ void ClientPrintHandlerGtk::OnPrintSettings(
|
|||||||
CefRefPtr<CefPrintSettings> settings,
|
CefRefPtr<CefPrintSettings> settings,
|
||||||
bool get_defaults) {
|
bool get_defaults) {
|
||||||
if (get_defaults) {
|
if (get_defaults) {
|
||||||
ASSERT(!page_setup_);
|
DCHECK(!page_setup_);
|
||||||
ASSERT(!printer_);
|
DCHECK(!printer_);
|
||||||
|
|
||||||
// |gtk_settings_| is a new copy.
|
// |gtk_settings_| is a new copy.
|
||||||
gtk_settings_ =
|
gtk_settings_ =
|
||||||
@ -330,7 +332,7 @@ void ClientPrintHandlerGtk::OnPrintSettings(
|
|||||||
cups_duplex_mode = kDuplexNone;
|
cups_duplex_mode = kDuplexNone;
|
||||||
break;
|
break;
|
||||||
default: // UNKNOWN_DUPLEX_MODE
|
default: // UNKNOWN_DUPLEX_MODE
|
||||||
ASSERT(false); // Not reached
|
NOTREACHED();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gtk_print_settings_set(gtk_settings_, kCUPSDuplex, cups_duplex_mode);
|
gtk_print_settings_set(gtk_settings_, kCUPSDuplex, cups_duplex_mode);
|
||||||
@ -441,7 +443,7 @@ void ClientPrintHandlerGtk::OnDialogResponse(GtkDialog *dialog,
|
|||||||
gint response_id) {
|
gint response_id) {
|
||||||
int num_matched_handlers = g_signal_handlers_disconnect_by_func(
|
int num_matched_handlers = g_signal_handlers_disconnect_by_func(
|
||||||
dialog_, reinterpret_cast<gpointer>(&OnDialogResponseThunk), this);
|
dialog_, reinterpret_cast<gpointer>(&OnDialogResponseThunk), this);
|
||||||
ASSERT(1 == num_matched_handlers);
|
DCHECK_EQ(1, num_matched_handlers);
|
||||||
|
|
||||||
gtk_widget_hide(dialog_);
|
gtk_widget_hide(dialog_);
|
||||||
|
|
||||||
@ -489,7 +491,7 @@ void ClientPrintHandlerGtk::OnDialogResponse(GtkDialog *dialog,
|
|||||||
break;
|
break;
|
||||||
case GTK_PRINT_PAGES_CURRENT:
|
case GTK_PRINT_PAGES_CURRENT:
|
||||||
default:
|
default:
|
||||||
ASSERT(false); // Not reached.
|
NOTREACHED();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,7 +511,7 @@ void ClientPrintHandlerGtk::OnDialogResponse(GtkDialog *dialog,
|
|||||||
}
|
}
|
||||||
case GTK_RESPONSE_APPLY:
|
case GTK_RESPONSE_APPLY:
|
||||||
default: {
|
default: {
|
||||||
ASSERT(false); // Not reached.
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "cefclient/resource_util.h"
|
#include "cefclient/resource_util.h"
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -18,7 +20,7 @@ bool AmIBundled() {
|
|||||||
FSRef fsref;
|
FSRef fsref;
|
||||||
OSStatus pbErr;
|
OSStatus pbErr;
|
||||||
if ((pbErr = GetProcessBundleLocation(&psn, &fsref)) != noErr) {
|
if ((pbErr = GetProcessBundleLocation(&psn, &fsref)) != noErr) {
|
||||||
ASSERT(false);
|
NOTREACHED();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +28,7 @@ bool AmIBundled() {
|
|||||||
OSErr fsErr;
|
OSErr fsErr;
|
||||||
if ((fsErr = FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &info,
|
if ((fsErr = FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &info,
|
||||||
NULL, NULL, NULL)) != noErr) {
|
NULL, NULL, NULL)) != noErr) {
|
||||||
ASSERT(false);
|
NOTREACHED();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +55,7 @@ bool GetResourceDir(std::string& dir) {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// TODO: Provide unbundled path
|
// TODO: Provide unbundled path
|
||||||
ASSERT(false);
|
NOTIMPLEMENTED();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "cefclient/resource_util.h"
|
#include "cefclient/resource_util.h"
|
||||||
|
#include "include/base/cef_logging.h"
|
||||||
#include "include/cef_stream.h"
|
#include "include/cef_stream.h"
|
||||||
#include "include/wrapper/cef_byte_read_handler.h"
|
#include "include/wrapper/cef_byte_read_handler.h"
|
||||||
#include "cefclient/resource.h"
|
#include "cefclient/resource.h"
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ bool LoadBinaryResource(const char* resource_name, std::string& resource_data) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(FALSE); // The resource should be found.
|
NOTREACHED(); // The resource should be found.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +87,6 @@ CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) {
|
|||||||
new CefByteReadHandler(pBytes, dwSize, NULL));
|
new CefByteReadHandler(pBytes, dwSize, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(FALSE); // The resource should be found.
|
NOTREACHED(); // The resource should be found.
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
#include "include/cef_response.h"
|
#include "include/cef_response.h"
|
||||||
#include "include/cef_request.h"
|
#include "include/cef_request.h"
|
||||||
#include "include/cef_scheme.h"
|
#include "include/cef_scheme.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "cefclient/resource_util.h"
|
#include "cefclient/resource_util.h"
|
||||||
#include "cefclient/string_util.h"
|
#include "cefclient/string_util.h"
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "cefclient/resource.h"
|
#include "cefclient/resource.h"
|
||||||
@ -32,7 +32,7 @@ class ClientSchemeHandler : public CefResourceHandler {
|
|||||||
virtual bool ProcessRequest(CefRefPtr<CefRequest> request,
|
virtual bool ProcessRequest(CefRefPtr<CefRequest> request,
|
||||||
CefRefPtr<CefCallback> callback)
|
CefRefPtr<CefCallback> callback)
|
||||||
OVERRIDE {
|
OVERRIDE {
|
||||||
REQUIRE_IO_THREAD();
|
CEF_REQUIRE_IO_THREAD();
|
||||||
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
@ -85,9 +85,9 @@ class ClientSchemeHandler : public CefResourceHandler {
|
|||||||
virtual void GetResponseHeaders(CefRefPtr<CefResponse> response,
|
virtual void GetResponseHeaders(CefRefPtr<CefResponse> response,
|
||||||
int64& response_length,
|
int64& response_length,
|
||||||
CefString& redirectUrl) OVERRIDE {
|
CefString& redirectUrl) OVERRIDE {
|
||||||
REQUIRE_IO_THREAD();
|
CEF_REQUIRE_IO_THREAD();
|
||||||
|
|
||||||
ASSERT(!data_.empty());
|
DCHECK(!data_.empty());
|
||||||
|
|
||||||
response->SetMimeType(mime_type_);
|
response->SetMimeType(mime_type_);
|
||||||
response->SetStatus(200);
|
response->SetStatus(200);
|
||||||
@ -97,7 +97,7 @@ class ClientSchemeHandler : public CefResourceHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void Cancel() OVERRIDE {
|
virtual void Cancel() OVERRIDE {
|
||||||
REQUIRE_IO_THREAD();
|
CEF_REQUIRE_IO_THREAD();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool ReadResponse(void* data_out,
|
virtual bool ReadResponse(void* data_out,
|
||||||
@ -105,7 +105,7 @@ class ClientSchemeHandler : public CefResourceHandler {
|
|||||||
int& bytes_read,
|
int& bytes_read,
|
||||||
CefRefPtr<CefCallback> callback)
|
CefRefPtr<CefCallback> callback)
|
||||||
OVERRIDE {
|
OVERRIDE {
|
||||||
REQUIRE_IO_THREAD();
|
CEF_REQUIRE_IO_THREAD();
|
||||||
|
|
||||||
bool has_data = false;
|
bool has_data = false;
|
||||||
bytes_read = 0;
|
bytes_read = 0;
|
||||||
@ -144,7 +144,7 @@ class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory {
|
|||||||
const CefString& scheme_name,
|
const CefString& scheme_name,
|
||||||
CefRefPtr<CefRequest> request)
|
CefRefPtr<CefRequest> request)
|
||||||
OVERRIDE {
|
OVERRIDE {
|
||||||
REQUIRE_IO_THREAD();
|
CEF_REQUIRE_IO_THREAD();
|
||||||
return new ClientSchemeHandler();
|
return new ClientSchemeHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,100 +0,0 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
|
||||||
// can be found in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef CEF_TESTS_CEFCLIENT_UTIL_H_
|
|
||||||
#define CEF_TESTS_CEFCLIENT_UTIL_H_
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "include/cef_task.h"
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
|
|
||||||
#include <windows.h> // NOLINT(build/include_order)
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
#define ASSERT(condition) if (!(condition)) { DebugBreak(); }
|
|
||||||
#else
|
|
||||||
#define ASSERT(condition) ((void)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else // !OS_WIN
|
|
||||||
|
|
||||||
#include <assert.h> // NOLINT(build/include_order)
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
#define ASSERT(condition) if (!(condition)) { assert(false); }
|
|
||||||
#else
|
|
||||||
#define ASSERT(condition) ((void)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // !OS_WIN
|
|
||||||
|
|
||||||
#define REQUIRE_UI_THREAD() ASSERT(CefCurrentlyOn(TID_UI));
|
|
||||||
#define REQUIRE_IO_THREAD() ASSERT(CefCurrentlyOn(TID_IO));
|
|
||||||
#define REQUIRE_FILE_THREAD() ASSERT(CefCurrentlyOn(TID_FILE));
|
|
||||||
|
|
||||||
// Helper class to manage a scoped copy of |argv|.
|
|
||||||
class ScopedArgArray {
|
|
||||||
public:
|
|
||||||
ScopedArgArray(int argc, char* argv[]) {
|
|
||||||
array_ = new char*[argc];
|
|
||||||
for (int i = 0; i < argc; ++i) {
|
|
||||||
values_.push_back(argv[i]);
|
|
||||||
array_[i] = const_cast<char*>(values_[i].c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
~ScopedArgArray() {
|
|
||||||
delete [] array_;
|
|
||||||
}
|
|
||||||
|
|
||||||
char** array() const { return array_; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
char** array_;
|
|
||||||
|
|
||||||
// Keep values in a vector separate from |array_| because various users may
|
|
||||||
// modify |array_| and we still want to clean up memory properly.
|
|
||||||
std::vector<std::string> values_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// The arraysize(arr) macro returns the # of elements in an array arr.
|
|
||||||
// The expression is a compile-time constant, and therefore can be
|
|
||||||
// used in defining new arrays, for example. If you use arraysize on
|
|
||||||
// a pointer by mistake, you will get a compile-time error.
|
|
||||||
//
|
|
||||||
// One caveat is that arraysize() doesn't accept any array of an
|
|
||||||
// anonymous type or a type defined inside a function. In these rare
|
|
||||||
// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is
|
|
||||||
// due to a limitation in C++'s template system. The limitation might
|
|
||||||
// eventually be removed, but it hasn't happened yet.
|
|
||||||
|
|
||||||
// This template function declaration is used in defining arraysize.
|
|
||||||
// Note that the function doesn't need an implementation, as we only
|
|
||||||
// use its type.
|
|
||||||
template <typename T, size_t N>
|
|
||||||
char (&ArraySizeHelper(T (&array)[N]))[N];
|
|
||||||
|
|
||||||
// That gcc wants both of these prototypes seems mysterious. VC, for
|
|
||||||
// its part, can't decide which to use (another mystery). Matching of
|
|
||||||
// template overloads: the final frontier.
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
template <typename T, size_t N>
|
|
||||||
char (&ArraySizeHelper(const T (&array)[N]))[N];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
|
|
||||||
|
|
||||||
|
|
||||||
// A macro to disallow the copy constructor and operator= functions
|
|
||||||
// This should be used in the private: declarations for a class
|
|
||||||
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
|
||||||
TypeName(const TypeName&); \
|
|
||||||
void operator=(const TypeName&)
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_UTIL_H_
|
|
@ -63,7 +63,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
} else if (message_name == kMessageRestoreName) {
|
} else if (message_name == kMessageRestoreName) {
|
||||||
Restore(browser->GetHost()->GetWindowHandle());
|
Restore(browser->GetHost()->GetWindowHandle());
|
||||||
} else {
|
} else {
|
||||||
ASSERT(false); // Not reached.
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
callback->Success("");
|
callback->Success("");
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include "cefsimple/simple_app.h"
|
#include "cefsimple/simple_app.h"
|
||||||
#include "cefsimple/simple_handler.h"
|
#include "cefsimple/simple_handler.h"
|
||||||
#include "cefsimple/util.h"
|
|
||||||
#include "include/cef_application_mac.h"
|
#include "include/cef_application_mac.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
// Receives notifications from the application.
|
// Receives notifications from the application.
|
||||||
@interface SimpleAppDelegate : NSObject
|
@interface SimpleAppDelegate : NSObject
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "cefsimple/simple_handler.h"
|
#include "cefsimple/simple_handler.h"
|
||||||
#include "cefsimple/util.h"
|
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_command_line.h"
|
#include "include/cef_command_line.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
SimpleApp::SimpleApp() {
|
SimpleApp::SimpleApp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleApp::OnContextInitialized() {
|
void SimpleApp::OnContextInitialized() {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Information used when creating the native window.
|
// Information used when creating the native window.
|
||||||
CefWindowInfo window_info;
|
CefWindowInfo window_info;
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "cefsimple/util.h"
|
|
||||||
#include "include/cef_app.h"
|
#include "include/cef_app.h"
|
||||||
#include "include/cef_runnable.h"
|
#include "include/cef_runnable.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ SimpleHandler* g_instance = NULL;
|
|||||||
|
|
||||||
SimpleHandler::SimpleHandler()
|
SimpleHandler::SimpleHandler()
|
||||||
: is_closing_(false) {
|
: is_closing_(false) {
|
||||||
ASSERT(!g_instance);
|
DCHECK(!g_instance);
|
||||||
g_instance = this;
|
g_instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,14 +33,14 @@ SimpleHandler* SimpleHandler::GetInstance() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SimpleHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
void SimpleHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Add to the list of existing browsers.
|
// Add to the list of existing browsers.
|
||||||
browser_list_.push_back(browser);
|
browser_list_.push_back(browser);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimpleHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
bool SimpleHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Closing the main window requires special handling. See the DoClose()
|
// Closing the main window requires special handling. See the DoClose()
|
||||||
// documentation in the CEF header for a detailed destription of this
|
// documentation in the CEF header for a detailed destription of this
|
||||||
@ -56,7 +56,7 @@ bool SimpleHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SimpleHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
void SimpleHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Remove from the list of existing browsers.
|
// Remove from the list of existing browsers.
|
||||||
BrowserList::iterator bit = browser_list_.begin();
|
BrowserList::iterator bit = browser_list_.begin();
|
||||||
@ -78,7 +78,7 @@ void SimpleHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
|||||||
ErrorCode errorCode,
|
ErrorCode errorCode,
|
||||||
const CefString& errorText,
|
const CefString& errorText,
|
||||||
const CefString& failedUrl) {
|
const CefString& failedUrl) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Don't display an error for downloaded files.
|
// Don't display an error for downloaded files.
|
||||||
if (errorCode == ERR_ABORTED)
|
if (errorCode == ERR_ABORTED)
|
||||||
|
@ -8,21 +8,21 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "cefsimple/util.h"
|
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
void SimpleHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
void SimpleHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& title) {
|
const CefString& title) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
std::string titleStr(title);
|
std::string titleStr(title);
|
||||||
|
|
||||||
// Retrieve the X11 display shared with Chromium.
|
// Retrieve the X11 display shared with Chromium.
|
||||||
::Display* display = cef_get_xdisplay();
|
::Display* display = cef_get_xdisplay();
|
||||||
ASSERT(display);
|
DCHECK(display);
|
||||||
|
|
||||||
// Retrieve the X11 window handle for the browser.
|
// Retrieve the X11 window handle for the browser.
|
||||||
::Window window = browser->GetHost()->GetWindowHandle();
|
::Window window = browser->GetHost()->GetWindowHandle();
|
||||||
ASSERT(window != kNullWindowHandle);
|
DCHECK_NE(window, kNullWindowHandle);
|
||||||
|
|
||||||
// Retrieve the atoms required by the below XChangeProperty call.
|
// Retrieve the atoms required by the below XChangeProperty call.
|
||||||
const char* kAtoms[] = {
|
const char* kAtoms[] = {
|
||||||
@ -33,7 +33,7 @@ void SimpleHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
|||||||
int result = XInternAtoms(display, const_cast<char**>(kAtoms), 2, false,
|
int result = XInternAtoms(display, const_cast<char**>(kAtoms), 2, false,
|
||||||
atoms);
|
atoms);
|
||||||
if (!result)
|
if (!result)
|
||||||
ASSERT(false);
|
NOTREACHED();
|
||||||
|
|
||||||
// Set the window title.
|
// Set the window title.
|
||||||
XChangeProperty(display,
|
XChangeProperty(display,
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include "cefsimple/util.h"
|
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
void SimpleHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
void SimpleHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& title) {
|
const CefString& title) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
NSView* view = (NSView*)browser->GetHost()->GetWindowHandle();
|
NSView* view = (NSView*)browser->GetHost()->GetWindowHandle();
|
||||||
NSWindow* window = [view window];
|
NSWindow* window = [view window];
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "cefsimple/util.h"
|
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
|
|
||||||
void SimpleHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
void SimpleHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& title) {
|
const CefString& title) {
|
||||||
REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();
|
CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();
|
||||||
SetWindowText(hwnd, std::wstring(title).c_str());
|
SetWindowText(hwnd, std::wstring(title).c_str());
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
|
||||||
// can be found in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef CEF_TESTS_CEFCLIENT_UTIL_H_
|
|
||||||
#define CEF_TESTS_CEFCLIENT_UTIL_H_
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "include/cef_task.h"
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
|
|
||||||
#include <windows.h> // NOLINT(build/include_order)
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
#define ASSERT(condition) if (!(condition)) { DebugBreak(); }
|
|
||||||
#else
|
|
||||||
#define ASSERT(condition) ((void)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else // !OS_WIN
|
|
||||||
|
|
||||||
#include <assert.h> // NOLINT(build/include_order)
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
#define ASSERT(condition) if (!(condition)) { assert(false); }
|
|
||||||
#else
|
|
||||||
#define ASSERT(condition) ((void)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // !OS_WIN
|
|
||||||
|
|
||||||
#define REQUIRE_UI_THREAD() ASSERT(CefCurrentlyOn(TID_UI));
|
|
||||||
#define REQUIRE_IO_THREAD() ASSERT(CefCurrentlyOn(TID_IO));
|
|
||||||
#define REQUIRE_FILE_THREAD() ASSERT(CefCurrentlyOn(TID_FILE));
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_UTIL_H_
|
|
@ -2,10 +2,13 @@
|
|||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Include this first to avoid conflicts with base/cef_logging.h.
|
||||||
|
#include "base/logging.h"
|
||||||
|
|
||||||
#include "include/cef_app.h"
|
#include "include/cef_app.h"
|
||||||
#include "include/cef_task.h"
|
#include "include/cef_task.h"
|
||||||
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "tests/cefclient/client_app.h"
|
#include "tests/cefclient/client_app.h"
|
||||||
#include "tests/cefclient/util.h"
|
|
||||||
#include "tests/unittests/test_handler.h"
|
#include "tests/unittests/test_handler.h"
|
||||||
#include "tests/unittests/test_suite.h"
|
#include "tests/unittests/test_suite.h"
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
@ -62,7 +65,7 @@ int main(int argc, char* argv[]) {
|
|||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
// Create a copy of |argv| on Linux because Chromium mangles the value
|
// Create a copy of |argv| on Linux because Chromium mangles the value
|
||||||
// internally (see issue #620).
|
// internally (see issue #620).
|
||||||
ScopedArgArray scoped_arg_array(argc, argv);
|
CefScopedArgArray scoped_arg_array(argc, argv);
|
||||||
char** argv_copy = scoped_arg_array.array();
|
char** argv_copy = scoped_arg_array.array();
|
||||||
#else
|
#else
|
||||||
char** argv_copy = argv;
|
char** argv_copy = argv;
|
||||||
|
@ -7,60 +7,60 @@
|
|||||||
#include "include/cef_runnable.h"
|
#include "include/cef_runnable.h"
|
||||||
#include "include/cef_task.h"
|
#include "include/cef_task.h"
|
||||||
#include "include/cef_trace.h"
|
#include "include/cef_trace.h"
|
||||||
#include "include/cef_trace_event.h"
|
#include "include/base/cef_trace_event.h"
|
||||||
#include "tests/unittests/test_handler.h"
|
#include "tests/unittests/test_handler.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
enum TracingTestType {
|
enum TracingTestType {
|
||||||
CEF_TRACE_EVENT0,
|
TT_TRACE_EVENT0,
|
||||||
CEF_TRACE_EVENT1,
|
TT_TRACE_EVENT1,
|
||||||
CEF_TRACE_EVENT2,
|
TT_TRACE_EVENT2,
|
||||||
CEF_TRACE_EVENT_INSTANT0,
|
TT_TRACE_EVENT_INSTANT0,
|
||||||
CEF_TRACE_EVENT_INSTANT1,
|
TT_TRACE_EVENT_INSTANT1,
|
||||||
CEF_TRACE_EVENT_INSTANT2,
|
TT_TRACE_EVENT_INSTANT2,
|
||||||
CEF_TRACE_EVENT_COPY_INSTANT0,
|
TT_TRACE_EVENT_COPY_INSTANT0,
|
||||||
CEF_TRACE_EVENT_COPY_INSTANT1,
|
TT_TRACE_EVENT_COPY_INSTANT1,
|
||||||
CEF_TRACE_EVENT_COPY_INSTANT2,
|
TT_TRACE_EVENT_COPY_INSTANT2,
|
||||||
CEF_TRACE_EVENT_BEGIN0,
|
TT_TRACE_EVENT_BEGIN0,
|
||||||
CEF_TRACE_EVENT_BEGIN1,
|
TT_TRACE_EVENT_BEGIN1,
|
||||||
CEF_TRACE_EVENT_BEGIN2,
|
TT_TRACE_EVENT_BEGIN2,
|
||||||
CEF_TRACE_EVENT_COPY_BEGIN0,
|
TT_TRACE_EVENT_COPY_BEGIN0,
|
||||||
CEF_TRACE_EVENT_COPY_BEGIN1,
|
TT_TRACE_EVENT_COPY_BEGIN1,
|
||||||
CEF_TRACE_EVENT_COPY_BEGIN2,
|
TT_TRACE_EVENT_COPY_BEGIN2,
|
||||||
CEF_TRACE_EVENT_END0,
|
TT_TRACE_EVENT_END0,
|
||||||
CEF_TRACE_EVENT_END1,
|
TT_TRACE_EVENT_END1,
|
||||||
CEF_TRACE_EVENT_END2,
|
TT_TRACE_EVENT_END2,
|
||||||
CEF_TRACE_EVENT_COPY_END0,
|
TT_TRACE_EVENT_COPY_END0,
|
||||||
CEF_TRACE_EVENT_COPY_END1,
|
TT_TRACE_EVENT_COPY_END1,
|
||||||
CEF_TRACE_EVENT_COPY_END2,
|
TT_TRACE_EVENT_COPY_END2,
|
||||||
CEF_TRACE_COUNTER1,
|
TT_TRACE_COUNTER1,
|
||||||
CEF_TRACE_COPY_COUNTER1,
|
TT_TRACE_COPY_COUNTER1,
|
||||||
CEF_TRACE_COUNTER2,
|
TT_TRACE_COUNTER2,
|
||||||
CEF_TRACE_COPY_COUNTER2,
|
TT_TRACE_COPY_COUNTER2,
|
||||||
CEF_TRACE_COUNTER_ID1,
|
TT_TRACE_COUNTER_ID1,
|
||||||
CEF_TRACE_COPY_COUNTER_ID1,
|
TT_TRACE_COPY_COUNTER_ID1,
|
||||||
CEF_TRACE_COUNTER_ID2,
|
TT_TRACE_COUNTER_ID2,
|
||||||
CEF_TRACE_COPY_COUNTER_ID2,
|
TT_TRACE_COPY_COUNTER_ID2,
|
||||||
CEF_TRACE_EVENT_ASYNC_BEGIN0,
|
TT_TRACE_EVENT_ASYNC_BEGIN0,
|
||||||
CEF_TRACE_EVENT_ASYNC_BEGIN1,
|
TT_TRACE_EVENT_ASYNC_BEGIN1,
|
||||||
CEF_TRACE_EVENT_ASYNC_BEGIN2,
|
TT_TRACE_EVENT_ASYNC_BEGIN2,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_BEGIN0,
|
TT_TRACE_EVENT_COPY_ASYNC_BEGIN0,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_BEGIN1,
|
TT_TRACE_EVENT_COPY_ASYNC_BEGIN1,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_BEGIN2,
|
TT_TRACE_EVENT_COPY_ASYNC_BEGIN2,
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_INTO0,
|
TT_TRACE_EVENT_ASYNC_STEP_INTO0,
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_INTO1,
|
TT_TRACE_EVENT_ASYNC_STEP_INTO1,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO0,
|
TT_TRACE_EVENT_COPY_ASYNC_STEP_INTO0,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO1,
|
TT_TRACE_EVENT_COPY_ASYNC_STEP_INTO1,
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_PAST0,
|
TT_TRACE_EVENT_ASYNC_STEP_PAST0,
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_PAST1,
|
TT_TRACE_EVENT_ASYNC_STEP_PAST1,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST0,
|
TT_TRACE_EVENT_COPY_ASYNC_STEP_PAST0,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST1,
|
TT_TRACE_EVENT_COPY_ASYNC_STEP_PAST1,
|
||||||
CEF_TRACE_EVENT_ASYNC_END0,
|
TT_TRACE_EVENT_ASYNC_END0,
|
||||||
CEF_TRACE_EVENT_ASYNC_END1,
|
TT_TRACE_EVENT_ASYNC_END1,
|
||||||
CEF_TRACE_EVENT_ASYNC_END2,
|
TT_TRACE_EVENT_ASYNC_END2,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_END0,
|
TT_TRACE_EVENT_COPY_ASYNC_END0,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_END1,
|
TT_TRACE_EVENT_COPY_ASYNC_END1,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_END2
|
TT_TRACE_EVENT_COPY_ASYNC_END2
|
||||||
};
|
};
|
||||||
|
|
||||||
const char kTraceTestCategory[] = "test_category";
|
const char kTraceTestCategory[] = "test_category";
|
||||||
@ -104,217 +104,213 @@ class TracingTestHandler : public CefEndTracingCallback,
|
|||||||
EXPECT_UI_THREAD();
|
EXPECT_UI_THREAD();
|
||||||
|
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
case CEF_TRACE_EVENT0: {
|
case TT_TRACE_EVENT0: {
|
||||||
CEF_TRACE_EVENT0(kTraceTestCategory, "CEF_TRACE_EVENT0");
|
TRACE_EVENT0(kTraceTestCategory, "TT_TRACE_EVENT0");
|
||||||
} break;
|
} break;
|
||||||
case CEF_TRACE_EVENT1: {
|
case TT_TRACE_EVENT1: {
|
||||||
CEF_TRACE_EVENT1(kTraceTestCategory, "CEF_TRACE_EVENT1", "arg1", 1);
|
TRACE_EVENT1(kTraceTestCategory, "TT_TRACE_EVENT1", "arg1", 1);
|
||||||
} break;
|
} break;
|
||||||
case CEF_TRACE_EVENT2: {
|
case TT_TRACE_EVENT2: {
|
||||||
CEF_TRACE_EVENT2(kTraceTestCategory, "CEF_TRACE_EVENT2", "arg1", 1,
|
TRACE_EVENT2(kTraceTestCategory, "TT_TRACE_EVENT2", "arg1", 1,
|
||||||
"arg2", 2);
|
"arg2", 2);
|
||||||
} break;
|
} break;
|
||||||
case CEF_TRACE_EVENT_INSTANT0:
|
case TT_TRACE_EVENT_INSTANT0:
|
||||||
CEF_TRACE_EVENT_INSTANT0(kTraceTestCategory,
|
TRACE_EVENT_INSTANT0(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_INSTANT0");
|
"TT_TRACE_EVENT_INSTANT0");
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_INSTANT1:
|
case TT_TRACE_EVENT_INSTANT1:
|
||||||
CEF_TRACE_EVENT_INSTANT1(kTraceTestCategory, "CEF_TRACE_EVENT_INSTANT1",
|
TRACE_EVENT_INSTANT1(kTraceTestCategory, "TT_TRACE_EVENT_INSTANT1",
|
||||||
"arg1", 1);
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_INSTANT2:
|
|
||||||
CEF_TRACE_EVENT_INSTANT2(kTraceTestCategory, "CEF_TRACE_EVENT_INSTANT2",
|
|
||||||
"arg1", 1, "arg2", 2);
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_COPY_INSTANT0:
|
|
||||||
CEF_TRACE_EVENT_COPY_INSTANT0(kTraceTestCategory,
|
|
||||||
"CEF_TRACE_EVENT_COPY_INSTANT0");
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_COPY_INSTANT1:
|
|
||||||
CEF_TRACE_EVENT_COPY_INSTANT1(kTraceTestCategory,
|
|
||||||
"CEF_TRACE_EVENT_COPY_INSTANT1",
|
|
||||||
"arg1", 1);
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_COPY_INSTANT2:
|
|
||||||
CEF_TRACE_EVENT_COPY_INSTANT2(kTraceTestCategory,
|
|
||||||
"CEF_TRACE_EVENT_COPY_INSTANT2",
|
|
||||||
"arg1", 1, "arg2", 2);
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_BEGIN0:
|
|
||||||
CEF_TRACE_EVENT_BEGIN0(kTraceTestCategory, "CEF_TRACE_EVENT_BEGIN0");
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_BEGIN1:
|
|
||||||
CEF_TRACE_EVENT_BEGIN1(kTraceTestCategory, "CEF_TRACE_EVENT_BEGIN1",
|
|
||||||
"arg1", 1);
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_BEGIN2:
|
|
||||||
CEF_TRACE_EVENT_BEGIN2(kTraceTestCategory, "CEF_TRACE_EVENT_BEGIN2",
|
|
||||||
"arg1", 1, "arg2", 2);
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_COPY_BEGIN0:
|
|
||||||
CEF_TRACE_EVENT_COPY_BEGIN0(kTraceTestCategory,
|
|
||||||
"CEF_TRACE_EVENT_COPY_BEGIN0");
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_COPY_BEGIN1:
|
|
||||||
CEF_TRACE_EVENT_COPY_BEGIN1(kTraceTestCategory,
|
|
||||||
"CEF_TRACE_EVENT_COPY_BEGIN1",
|
|
||||||
"arg1", 1);
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_COPY_BEGIN2:
|
|
||||||
CEF_TRACE_EVENT_COPY_BEGIN2(kTraceTestCategory,
|
|
||||||
"CEF_TRACE_EVENT_COPY_BEGIN2",
|
|
||||||
"arg1", 1, "arg2", 2);
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_END0:
|
|
||||||
CEF_TRACE_EVENT_END0(kTraceTestCategory, "CEF_TRACE_EVENT_END0");
|
|
||||||
break;
|
|
||||||
case CEF_TRACE_EVENT_END1:
|
|
||||||
CEF_TRACE_EVENT_END1(kTraceTestCategory, "CEF_TRACE_EVENT_END1",
|
|
||||||
"arg1", 1);
|
"arg1", 1);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_END2:
|
case TT_TRACE_EVENT_INSTANT2:
|
||||||
CEF_TRACE_EVENT_END2(kTraceTestCategory, "CEF_TRACE_EVENT_END2",
|
TRACE_EVENT_INSTANT2(kTraceTestCategory, "TT_TRACE_EVENT_INSTANT2",
|
||||||
"arg1", 1, "arg2", 2);
|
"arg1", 1, "arg2", 2);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_END0:
|
case TT_TRACE_EVENT_COPY_INSTANT0:
|
||||||
CEF_TRACE_EVENT_COPY_END0(kTraceTestCategory,
|
TRACE_EVENT_COPY_INSTANT0(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_COPY_END0");
|
"TT_TRACE_EVENT_COPY_INSTANT0");
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_END1:
|
case TT_TRACE_EVENT_COPY_INSTANT1:
|
||||||
CEF_TRACE_EVENT_COPY_END1(kTraceTestCategory,
|
TRACE_EVENT_COPY_INSTANT1(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_COPY_END1", "arg1", 1);
|
"TT_TRACE_EVENT_COPY_INSTANT1",
|
||||||
|
"arg1", 1);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_END2:
|
case TT_TRACE_EVENT_COPY_INSTANT2:
|
||||||
CEF_TRACE_EVENT_COPY_END2(kTraceTestCategory,
|
TRACE_EVENT_COPY_INSTANT2(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_COPY_END2", "arg1", 1,
|
"TT_TRACE_EVENT_COPY_INSTANT2",
|
||||||
"arg2", 2);
|
"arg1", 1, "arg2", 2);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_COUNTER1:
|
case TT_TRACE_EVENT_BEGIN0:
|
||||||
CEF_TRACE_COUNTER1(kTraceTestCategory, "CEF_TRACE_COUNTER1", 5);
|
TRACE_EVENT_BEGIN0(kTraceTestCategory, "TT_TRACE_EVENT_BEGIN0");
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_COPY_COUNTER1:
|
case TT_TRACE_EVENT_BEGIN1:
|
||||||
CEF_TRACE_COPY_COUNTER1(kTraceTestCategory, "CEF_TRACE_COPY_COUNTER1",
|
TRACE_EVENT_BEGIN1(kTraceTestCategory, "TT_TRACE_EVENT_BEGIN1",
|
||||||
5);
|
"arg1", 1);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_COUNTER2:
|
case TT_TRACE_EVENT_BEGIN2:
|
||||||
CEF_TRACE_COUNTER2(kTraceTestCategory, "CEF_TRACE_COUNTER2", "val1", 5,
|
TRACE_EVENT_BEGIN2(kTraceTestCategory, "TT_TRACE_EVENT_BEGIN2",
|
||||||
"val2", 10);
|
"arg1", 1, "arg2", 2);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_COPY_COUNTER2:
|
case TT_TRACE_EVENT_COPY_BEGIN0:
|
||||||
CEF_TRACE_COPY_COUNTER2(kTraceTestCategory, "CEF_TRACE_COPY_COUNTER2",
|
TRACE_EVENT_COPY_BEGIN0(kTraceTestCategory,
|
||||||
"val1", 5, "val2", 10);
|
"TT_TRACE_EVENT_COPY_BEGIN0");
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_COUNTER_ID1:
|
case TT_TRACE_EVENT_COPY_BEGIN1:
|
||||||
CEF_TRACE_COUNTER_ID1(kTraceTestCategory, "CEF_TRACE_COUNTER_ID1", 100,
|
TRACE_EVENT_COPY_BEGIN1(kTraceTestCategory,
|
||||||
5);
|
"TT_TRACE_EVENT_COPY_BEGIN1",
|
||||||
|
"arg1", 1);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_COPY_COUNTER_ID1:
|
case TT_TRACE_EVENT_COPY_BEGIN2:
|
||||||
CEF_TRACE_COPY_COUNTER_ID1(kTraceTestCategory,
|
TRACE_EVENT_COPY_BEGIN2(kTraceTestCategory,
|
||||||
"CEF_TRACE_COPY_COUNTER_ID1", 100, 5);
|
"TT_TRACE_EVENT_COPY_BEGIN2",
|
||||||
|
"arg1", 1, "arg2", 2);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_COUNTER_ID2:
|
case TT_TRACE_EVENT_END0:
|
||||||
CEF_TRACE_COUNTER_ID2(kTraceTestCategory, "CEF_TRACE_COUNTER_ID2", 100,
|
TRACE_EVENT_END0(kTraceTestCategory, "TT_TRACE_EVENT_END0");
|
||||||
"val1", 5, "val2", 10);
|
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_COPY_COUNTER_ID2:
|
case TT_TRACE_EVENT_END1:
|
||||||
CEF_TRACE_COPY_COUNTER_ID2(kTraceTestCategory,
|
TRACE_EVENT_END1(kTraceTestCategory, "TT_TRACE_EVENT_END1",
|
||||||
"CEF_TRACE_COPY_COUNTER_ID2", 100,
|
"arg1", 1);
|
||||||
"val1", 5, "val2", 10);
|
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_ASYNC_BEGIN0:
|
case TT_TRACE_EVENT_END2:
|
||||||
CEF_TRACE_EVENT_ASYNC_BEGIN0(kTraceTestCategory,
|
TRACE_EVENT_END2(kTraceTestCategory, "TT_TRACE_EVENT_END2",
|
||||||
"CEF_TRACE_EVENT_ASYNC_BEGIN0", 100);
|
"arg1", 1, "arg2", 2);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_ASYNC_BEGIN1:
|
case TT_TRACE_EVENT_COPY_END0:
|
||||||
CEF_TRACE_EVENT_ASYNC_BEGIN1(kTraceTestCategory,
|
TRACE_EVENT_COPY_END0(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_ASYNC_BEGIN1", 100,
|
"TT_TRACE_EVENT_COPY_END0");
|
||||||
"arg1", 1);
|
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_ASYNC_BEGIN2:
|
case TT_TRACE_EVENT_COPY_END1:
|
||||||
CEF_TRACE_EVENT_ASYNC_BEGIN2(kTraceTestCategory,
|
TRACE_EVENT_COPY_END1(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_ASYNC_BEGIN2",
|
"TT_TRACE_EVENT_COPY_END1", "arg1", 1);
|
||||||
100, "arg1", 1, "arg2", 2);
|
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_ASYNC_BEGIN0:
|
case TT_TRACE_EVENT_COPY_END2:
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_BEGIN0(kTraceTestCategory,
|
TRACE_EVENT_COPY_END2(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_COPY_ASYNC_BEGIN0",
|
"TT_TRACE_EVENT_COPY_END2", "arg1", 1, "arg2", 2);
|
||||||
100);
|
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_ASYNC_BEGIN1:
|
case TT_TRACE_COUNTER1:
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_BEGIN1(kTraceTestCategory,
|
TRACE_COUNTER1(kTraceTestCategory, "TT_TRACE_COUNTER1", 5);
|
||||||
"CEF_TRACE_EVENT_COPY_ASYNC_BEGIN1",
|
|
||||||
100, "arg1", 1);
|
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_ASYNC_BEGIN2:
|
case TT_TRACE_COPY_COUNTER1:
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_BEGIN2(kTraceTestCategory,
|
TRACE_COPY_COUNTER1(kTraceTestCategory, "TT_TRACE_COPY_COUNTER1", 5);
|
||||||
"CEF_TRACE_EVENT_COPY_ASYNC_BEGIN2",
|
|
||||||
100, "arg1", 1, "arg2", 2);
|
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_ASYNC_STEP_INTO0:
|
case TT_TRACE_COUNTER2:
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_INTO0(
|
TRACE_COUNTER2(kTraceTestCategory, "TT_TRACE_COUNTER2", "val1", 5,
|
||||||
kTraceTestCategory, "CEF_TRACE_EVENT_ASYNC_STEP_INTO0", 100, 1000);
|
"val2", 10);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_ASYNC_STEP_INTO1:
|
case TT_TRACE_COPY_COUNTER2:
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_INTO1(
|
TRACE_COPY_COUNTER2(kTraceTestCategory, "TT_TRACE_COPY_COUNTER2",
|
||||||
kTraceTestCategory, "CEF_TRACE_EVENT_ASYNC_STEP_INTO1", 100, 1000,
|
"val1", 5, "val2", 10);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_COUNTER_ID1:
|
||||||
|
TRACE_COUNTER_ID1(kTraceTestCategory, "TT_TRACE_COUNTER_ID1", 100, 5);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_COPY_COUNTER_ID1:
|
||||||
|
TRACE_COPY_COUNTER_ID1(kTraceTestCategory,
|
||||||
|
"TT_TRACE_COPY_COUNTER_ID1", 100, 5);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_COUNTER_ID2:
|
||||||
|
TRACE_COUNTER_ID2(kTraceTestCategory, "TT_TRACE_COUNTER_ID2", 100,
|
||||||
|
"val1", 5, "val2", 10);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_COPY_COUNTER_ID2:
|
||||||
|
TRACE_COPY_COUNTER_ID2(kTraceTestCategory,
|
||||||
|
"TT_TRACE_COPY_COUNTER_ID2", 100,
|
||||||
|
"val1", 5, "val2", 10);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_EVENT_ASYNC_BEGIN0:
|
||||||
|
TRACE_EVENT_ASYNC_BEGIN0(kTraceTestCategory,
|
||||||
|
"TT_TRACE_EVENT_ASYNC_BEGIN0", 100);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_EVENT_ASYNC_BEGIN1:
|
||||||
|
TRACE_EVENT_ASYNC_BEGIN1(kTraceTestCategory,
|
||||||
|
"TT_TRACE_EVENT_ASYNC_BEGIN1", 100, "arg1", 1);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_EVENT_ASYNC_BEGIN2:
|
||||||
|
TRACE_EVENT_ASYNC_BEGIN2(kTraceTestCategory,
|
||||||
|
"TT_TRACE_EVENT_ASYNC_BEGIN2",
|
||||||
|
100, "arg1", 1, "arg2", 2);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_EVENT_COPY_ASYNC_BEGIN0:
|
||||||
|
TRACE_EVENT_COPY_ASYNC_BEGIN0(kTraceTestCategory,
|
||||||
|
"TT_TRACE_EVENT_COPY_ASYNC_BEGIN0",
|
||||||
|
100);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_EVENT_COPY_ASYNC_BEGIN1:
|
||||||
|
TRACE_EVENT_COPY_ASYNC_BEGIN1(kTraceTestCategory,
|
||||||
|
"TT_TRACE_EVENT_COPY_ASYNC_BEGIN1",
|
||||||
|
100, "arg1", 1);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_EVENT_COPY_ASYNC_BEGIN2:
|
||||||
|
TRACE_EVENT_COPY_ASYNC_BEGIN2(kTraceTestCategory,
|
||||||
|
"TT_TRACE_EVENT_COPY_ASYNC_BEGIN2",
|
||||||
|
100, "arg1", 1, "arg2", 2);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_EVENT_ASYNC_STEP_INTO0:
|
||||||
|
TRACE_EVENT_ASYNC_STEP_INTO0(
|
||||||
|
kTraceTestCategory, "TT_TRACE_EVENT_ASYNC_STEP_INTO0", 100, 1000);
|
||||||
|
break;
|
||||||
|
case TT_TRACE_EVENT_ASYNC_STEP_INTO1:
|
||||||
|
TRACE_EVENT_ASYNC_STEP_INTO1(
|
||||||
|
kTraceTestCategory, "TT_TRACE_EVENT_ASYNC_STEP_INTO1", 100, 1000,
|
||||||
"arg1", 1);
|
"arg1", 1);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO0:
|
case TT_TRACE_EVENT_COPY_ASYNC_STEP_INTO0:
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO0(
|
TRACE_EVENT_COPY_ASYNC_STEP_INTO0(
|
||||||
kTraceTestCategory, "CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO0", 100,
|
kTraceTestCategory, "TT_TRACE_EVENT_COPY_ASYNC_STEP_INTO0", 100,
|
||||||
1000);
|
1000);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO1:
|
case TT_TRACE_EVENT_COPY_ASYNC_STEP_INTO1:
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO1(
|
TRACE_EVENT_COPY_ASYNC_STEP_INTO1(
|
||||||
kTraceTestCategory, "CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO1", 100,
|
kTraceTestCategory, "TT_TRACE_EVENT_COPY_ASYNC_STEP_INTO1", 100,
|
||||||
1000, "arg1", 1);
|
1000, "arg1", 1);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_ASYNC_STEP_PAST0:
|
case TT_TRACE_EVENT_ASYNC_STEP_PAST0:
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_PAST0(
|
TRACE_EVENT_ASYNC_STEP_PAST0(
|
||||||
kTraceTestCategory, "CEF_TRACE_EVENT_ASYNC_STEP_PAST0", 100, 1000);
|
kTraceTestCategory, "TT_TRACE_EVENT_ASYNC_STEP_PAST0", 100, 1000);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_ASYNC_STEP_PAST1:
|
case TT_TRACE_EVENT_ASYNC_STEP_PAST1:
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_PAST1(
|
TRACE_EVENT_ASYNC_STEP_PAST1(
|
||||||
kTraceTestCategory, "CEF_TRACE_EVENT_ASYNC_STEP_PAST1", 100, 1000,
|
kTraceTestCategory, "TT_TRACE_EVENT_ASYNC_STEP_PAST1", 100, 1000,
|
||||||
"arg1", 1);
|
"arg1", 1);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST0:
|
case TT_TRACE_EVENT_COPY_ASYNC_STEP_PAST0:
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST0(
|
TRACE_EVENT_COPY_ASYNC_STEP_PAST0(
|
||||||
kTraceTestCategory, "CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST0", 100,
|
kTraceTestCategory, "TT_TRACE_EVENT_COPY_ASYNC_STEP_PAST0", 100,
|
||||||
1000);
|
1000);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST1:
|
case TT_TRACE_EVENT_COPY_ASYNC_STEP_PAST1:
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST1(
|
TRACE_EVENT_COPY_ASYNC_STEP_PAST1(
|
||||||
kTraceTestCategory, "CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST1", 100,
|
kTraceTestCategory, "TT_TRACE_EVENT_COPY_ASYNC_STEP_PAST1", 100,
|
||||||
1000, "arg1", 1);
|
1000, "arg1", 1);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_ASYNC_END0:
|
case TT_TRACE_EVENT_ASYNC_END0:
|
||||||
CEF_TRACE_EVENT_ASYNC_END0(kTraceTestCategory,
|
TRACE_EVENT_ASYNC_END0(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_ASYNC_END0", 100);
|
"TT_TRACE_EVENT_ASYNC_END0", 100);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_ASYNC_END1:
|
case TT_TRACE_EVENT_ASYNC_END1:
|
||||||
CEF_TRACE_EVENT_ASYNC_END1(kTraceTestCategory,
|
TRACE_EVENT_ASYNC_END1(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_ASYNC_END1", 100,
|
"TT_TRACE_EVENT_ASYNC_END1", 100,
|
||||||
"arg1", 1);
|
"arg1", 1);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_ASYNC_END2:
|
case TT_TRACE_EVENT_ASYNC_END2:
|
||||||
CEF_TRACE_EVENT_ASYNC_END2(kTraceTestCategory,
|
TRACE_EVENT_ASYNC_END2(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_ASYNC_END2", 100,
|
"TT_TRACE_EVENT_ASYNC_END2", 100,
|
||||||
"arg1", 1, "arg2", 2);
|
"arg1", 1, "arg2", 2);
|
||||||
case CEF_TRACE_EVENT_COPY_ASYNC_END0:
|
case TT_TRACE_EVENT_COPY_ASYNC_END0:
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_END0(kTraceTestCategory,
|
TRACE_EVENT_COPY_ASYNC_END0(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_COPY_ASYNC_END0",
|
"TT_TRACE_EVENT_COPY_ASYNC_END0",
|
||||||
100);
|
100);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_ASYNC_END1:
|
case TT_TRACE_EVENT_COPY_ASYNC_END1:
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_END1(kTraceTestCategory,
|
TRACE_EVENT_COPY_ASYNC_END1(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_COPY_ASYNC_END1",
|
"TT_TRACE_EVENT_COPY_ASYNC_END1",
|
||||||
100, "arg1", 1);
|
100, "arg1", 1);
|
||||||
break;
|
break;
|
||||||
case CEF_TRACE_EVENT_COPY_ASYNC_END2:
|
case TT_TRACE_EVENT_COPY_ASYNC_END2:
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_END2(kTraceTestCategory,
|
TRACE_EVENT_COPY_ASYNC_END2(kTraceTestCategory,
|
||||||
"CEF_TRACE_EVENT_COPY_ASYNC_END2",
|
"TT_TRACE_EVENT_COPY_ASYNC_END2",
|
||||||
100, "arg1", 1, "arg2", 2);
|
100, "arg1", 1, "arg2", 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,64 +354,64 @@ class TracingTestHandler : public CefEndTracingCallback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define the tests.
|
// Define the tests.
|
||||||
TRACING_TEST(TraceEvent0, CEF_TRACE_EVENT0);
|
TRACING_TEST(TraceEvent0, TT_TRACE_EVENT0);
|
||||||
TRACING_TEST(TraceEvent1, CEF_TRACE_EVENT1);
|
TRACING_TEST(TraceEvent1, TT_TRACE_EVENT1);
|
||||||
TRACING_TEST(TraceEvent2, CEF_TRACE_EVENT2);
|
TRACING_TEST(TraceEvent2, TT_TRACE_EVENT2);
|
||||||
TRACING_TEST(TraceEventInstant0, CEF_TRACE_EVENT_INSTANT0);
|
TRACING_TEST(TraceEventInstant0, TT_TRACE_EVENT_INSTANT0);
|
||||||
TRACING_TEST(TraceEventInstant1, CEF_TRACE_EVENT_INSTANT1);
|
TRACING_TEST(TraceEventInstant1, TT_TRACE_EVENT_INSTANT1);
|
||||||
TRACING_TEST(TraceEventInstant2, CEF_TRACE_EVENT_INSTANT2);
|
TRACING_TEST(TraceEventInstant2, TT_TRACE_EVENT_INSTANT2);
|
||||||
TRACING_TEST(TraceEventCopyInstant0, CEF_TRACE_EVENT_COPY_INSTANT0);
|
TRACING_TEST(TraceEventCopyInstant0, TT_TRACE_EVENT_COPY_INSTANT0);
|
||||||
TRACING_TEST(TraceEventCopyInstant1, CEF_TRACE_EVENT_COPY_INSTANT1);
|
TRACING_TEST(TraceEventCopyInstant1, TT_TRACE_EVENT_COPY_INSTANT1);
|
||||||
TRACING_TEST(TraceEventCopyInstant2, CEF_TRACE_EVENT_COPY_INSTANT2);
|
TRACING_TEST(TraceEventCopyInstant2, TT_TRACE_EVENT_COPY_INSTANT2);
|
||||||
TRACING_TEST(TraceEventBegin0, CEF_TRACE_EVENT_BEGIN0);
|
TRACING_TEST(TraceEventBegin0, TT_TRACE_EVENT_BEGIN0);
|
||||||
TRACING_TEST(TraceEventBegin1, CEF_TRACE_EVENT_BEGIN1);
|
TRACING_TEST(TraceEventBegin1, TT_TRACE_EVENT_BEGIN1);
|
||||||
TRACING_TEST(TraceEventBegin2, CEF_TRACE_EVENT_BEGIN2);
|
TRACING_TEST(TraceEventBegin2, TT_TRACE_EVENT_BEGIN2);
|
||||||
TRACING_TEST(TraceEventCopyBegin0, CEF_TRACE_EVENT_COPY_BEGIN0);
|
TRACING_TEST(TraceEventCopyBegin0, TT_TRACE_EVENT_COPY_BEGIN0);
|
||||||
TRACING_TEST(TraceEventCopyBegin1, CEF_TRACE_EVENT_COPY_BEGIN1);
|
TRACING_TEST(TraceEventCopyBegin1, TT_TRACE_EVENT_COPY_BEGIN1);
|
||||||
TRACING_TEST(TraceEventCopyBegin2, CEF_TRACE_EVENT_COPY_BEGIN2);
|
TRACING_TEST(TraceEventCopyBegin2, TT_TRACE_EVENT_COPY_BEGIN2);
|
||||||
TRACING_TEST(TraceEventEnd0, CEF_TRACE_EVENT_END0);
|
TRACING_TEST(TraceEventEnd0, TT_TRACE_EVENT_END0);
|
||||||
TRACING_TEST(TraceEventEnd1, CEF_TRACE_EVENT_END1);
|
TRACING_TEST(TraceEventEnd1, TT_TRACE_EVENT_END1);
|
||||||
TRACING_TEST(TraceEventEnd2, CEF_TRACE_EVENT_END2);
|
TRACING_TEST(TraceEventEnd2, TT_TRACE_EVENT_END2);
|
||||||
TRACING_TEST(TraceEventCopyEnd0, CEF_TRACE_EVENT_COPY_END0);
|
TRACING_TEST(TraceEventCopyEnd0, TT_TRACE_EVENT_COPY_END0);
|
||||||
TRACING_TEST(TraceEventCopyEnd1, CEF_TRACE_EVENT_COPY_END1);
|
TRACING_TEST(TraceEventCopyEnd1, TT_TRACE_EVENT_COPY_END1);
|
||||||
TRACING_TEST(TraceEventCopyEnd2, CEF_TRACE_EVENT_COPY_END1);
|
TRACING_TEST(TraceEventCopyEnd2, TT_TRACE_EVENT_COPY_END1);
|
||||||
TRACING_TEST(TraceCounter1, CEF_TRACE_COUNTER1);
|
TRACING_TEST(TraceCounter1, TT_TRACE_COUNTER1);
|
||||||
TRACING_TEST(TraceCopyCounter1, CEF_TRACE_COPY_COUNTER1);
|
TRACING_TEST(TraceCopyCounter1, TT_TRACE_COPY_COUNTER1);
|
||||||
TRACING_TEST(TraceCounter2, CEF_TRACE_COUNTER2);
|
TRACING_TEST(TraceCounter2, TT_TRACE_COUNTER2);
|
||||||
TRACING_TEST(TraceCopyCounter2, CEF_TRACE_COPY_COUNTER2);
|
TRACING_TEST(TraceCopyCounter2, TT_TRACE_COPY_COUNTER2);
|
||||||
TRACING_TEST(TraceCounterId1, CEF_TRACE_COUNTER_ID1);
|
TRACING_TEST(TraceCounterId1, TT_TRACE_COUNTER_ID1);
|
||||||
TRACING_TEST(TraceCopyCounterId1, CEF_TRACE_COPY_COUNTER_ID1);
|
TRACING_TEST(TraceCopyCounterId1, TT_TRACE_COPY_COUNTER_ID1);
|
||||||
TRACING_TEST(TraceCounterId2, CEF_TRACE_COUNTER_ID2);
|
TRACING_TEST(TraceCounterId2, TT_TRACE_COUNTER_ID2);
|
||||||
TRACING_TEST(TraceCopyCounterId2, CEF_TRACE_COPY_COUNTER_ID1);
|
TRACING_TEST(TraceCopyCounterId2, TT_TRACE_COPY_COUNTER_ID1);
|
||||||
TRACING_TEST(TraceEventAsyncBegin0, CEF_TRACE_EVENT_ASYNC_BEGIN0);
|
TRACING_TEST(TraceEventAsyncBegin0, TT_TRACE_EVENT_ASYNC_BEGIN0);
|
||||||
TRACING_TEST(TraceEventAsyncBegin1, CEF_TRACE_EVENT_ASYNC_BEGIN1);
|
TRACING_TEST(TraceEventAsyncBegin1, TT_TRACE_EVENT_ASYNC_BEGIN1);
|
||||||
TRACING_TEST(TraceEventAsyncBegin2, CEF_TRACE_EVENT_ASYNC_BEGIN2);
|
TRACING_TEST(TraceEventAsyncBegin2, TT_TRACE_EVENT_ASYNC_BEGIN2);
|
||||||
TRACING_TEST(TraceEventCopyAsyncBegin0,
|
TRACING_TEST(TraceEventCopyAsyncBegin0,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_BEGIN0);
|
TT_TRACE_EVENT_COPY_ASYNC_BEGIN0);
|
||||||
TRACING_TEST(TraceEventCopyAsyncBegin1,
|
TRACING_TEST(TraceEventCopyAsyncBegin1,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_BEGIN1);
|
TT_TRACE_EVENT_COPY_ASYNC_BEGIN1);
|
||||||
TRACING_TEST(TraceEventCopyAsyncBegin2,
|
TRACING_TEST(TraceEventCopyAsyncBegin2,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_BEGIN2);
|
TT_TRACE_EVENT_COPY_ASYNC_BEGIN2);
|
||||||
TRACING_TEST(TraceEventAsyncStepInto0,
|
TRACING_TEST(TraceEventAsyncStepInto0,
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_INTO0);
|
TT_TRACE_EVENT_ASYNC_STEP_INTO0);
|
||||||
TRACING_TEST(TraceEventAsyncStepInto1,
|
TRACING_TEST(TraceEventAsyncStepInto1,
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_INTO1);
|
TT_TRACE_EVENT_ASYNC_STEP_INTO1);
|
||||||
TRACING_TEST(TraceEventCopyAsyncStepInto0,
|
TRACING_TEST(TraceEventCopyAsyncStepInto0,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO0);
|
TT_TRACE_EVENT_COPY_ASYNC_STEP_INTO0);
|
||||||
TRACING_TEST(TraceEventCopyAsyncStepInto1,
|
TRACING_TEST(TraceEventCopyAsyncStepInto1,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_INTO1);
|
TT_TRACE_EVENT_COPY_ASYNC_STEP_INTO1);
|
||||||
TRACING_TEST(TraceEventAsyncStepPast0,
|
TRACING_TEST(TraceEventAsyncStepPast0,
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_PAST0);
|
TT_TRACE_EVENT_ASYNC_STEP_PAST0);
|
||||||
TRACING_TEST(TraceEventAsyncStepPast1,
|
TRACING_TEST(TraceEventAsyncStepPast1,
|
||||||
CEF_TRACE_EVENT_ASYNC_STEP_PAST1);
|
TT_TRACE_EVENT_ASYNC_STEP_PAST1);
|
||||||
TRACING_TEST(TraceEventCopyAsyncStepPast0,
|
TRACING_TEST(TraceEventCopyAsyncStepPast0,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST0);
|
TT_TRACE_EVENT_COPY_ASYNC_STEP_PAST0);
|
||||||
TRACING_TEST(TraceEventCopyAsyncStepPast1,
|
TRACING_TEST(TraceEventCopyAsyncStepPast1,
|
||||||
CEF_TRACE_EVENT_COPY_ASYNC_STEP_PAST1);
|
TT_TRACE_EVENT_COPY_ASYNC_STEP_PAST1);
|
||||||
TRACING_TEST(TraceEventAsyncEnd0, CEF_TRACE_EVENT_ASYNC_END0);
|
TRACING_TEST(TraceEventAsyncEnd0, TT_TRACE_EVENT_ASYNC_END0);
|
||||||
TRACING_TEST(TraceEventAsyncEnd1, CEF_TRACE_EVENT_ASYNC_END1);
|
TRACING_TEST(TraceEventAsyncEnd1, TT_TRACE_EVENT_ASYNC_END1);
|
||||||
TRACING_TEST(TraceEventAsyncEnd2, CEF_TRACE_EVENT_ASYNC_END2);
|
TRACING_TEST(TraceEventAsyncEnd2, TT_TRACE_EVENT_ASYNC_END2);
|
||||||
TRACING_TEST(TraceEventCopyAsyncEnd0, CEF_TRACE_EVENT_COPY_ASYNC_END0);
|
TRACING_TEST(TraceEventCopyAsyncEnd0, TT_TRACE_EVENT_COPY_ASYNC_END0);
|
||||||
|
|
||||||
|
|
||||||
TEST(TracingTest, NowFromSystemTraceTime) {
|
TEST(TracingTest, NowFromSystemTraceTime) {
|
||||||
|
@ -848,7 +848,7 @@ class RequestRendererTest : public ClientApp::RenderDelegate,
|
|||||||
public RequestTestRunner::Delegate {
|
public RequestTestRunner::Delegate {
|
||||||
public:
|
public:
|
||||||
RequestRendererTest()
|
RequestRendererTest()
|
||||||
: ALLOW_THIS_IN_INITIALIZER_LIST(test_runner_(this, false)) {
|
: test_runner_(this, false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool OnProcessMessageReceived(
|
virtual bool OnProcessMessageReceived(
|
||||||
@ -913,7 +913,7 @@ class RequestTestHandler : public TestHandler,
|
|||||||
: test_mode_(test_mode),
|
: test_mode_(test_mode),
|
||||||
test_in_browser_(test_in_browser),
|
test_in_browser_(test_in_browser),
|
||||||
test_url_(test_url),
|
test_url_(test_url),
|
||||||
ALLOW_THIS_IN_INITIALIZER_LIST(test_runner_(this, true)) {
|
test_runner_(this, true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void RunTest() OVERRIDE {
|
virtual void RunTest() OVERRIDE {
|
||||||
|
@ -30,18 +30,17 @@ class cef_api_hash:
|
|||||||
|
|
||||||
self.platform_files = {
|
self.platform_files = {
|
||||||
"windows": [
|
"windows": [
|
||||||
"internal/cef_types_win.h"
|
"internal/cef_types_win.h",
|
||||||
],
|
],
|
||||||
"macosx": [
|
"macosx": [
|
||||||
"internal/cef_types_mac.h",
|
"internal/cef_types_mac.h",
|
||||||
],
|
],
|
||||||
"linux": [
|
"linux": [
|
||||||
"internal/cef_types_linux.h"
|
"internal/cef_types_linux.h",
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
self.included_files = [
|
self.included_files = [
|
||||||
"cef_trace_event.h"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
self.excluded_files = [
|
self.excluded_files = [
|
||||||
|
@ -65,7 +65,7 @@ def make_ctocpp_function_impl_new(clsname, name, func):
|
|||||||
result += '\n const char* api_hash = cef_api_hash(0);'\
|
result += '\n const char* api_hash = cef_api_hash(0);'\
|
||||||
'\n if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {'\
|
'\n if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {'\
|
||||||
'\n // The libcef API hash does not match the current header API hash.'\
|
'\n // The libcef API hash does not match the current header API hash.'\
|
||||||
'\n DCHECK(false);'\
|
'\n NOTREACHED();'\
|
||||||
'\n return'+retval_default+';'\
|
'\n return'+retval_default+';'\
|
||||||
'\n }\n'
|
'\n }\n'
|
||||||
|
|
||||||
|
@ -116,10 +116,10 @@ def write_svn_header(header, chrome_version, cef_version, cpp_header_dir):
|
|||||||
'#define DO_MAKE_STRING(p) #p\n'+\
|
'#define DO_MAKE_STRING(p) #p\n'+\
|
||||||
'#define MAKE_STRING(p) DO_MAKE_STRING(p)\n\n'+\
|
'#define MAKE_STRING(p) DO_MAKE_STRING(p)\n\n'+\
|
||||||
'#ifndef APSTUDIO_HIDDEN_SYMBOLS\n\n'\
|
'#ifndef APSTUDIO_HIDDEN_SYMBOLS\n\n'\
|
||||||
|
'#include "include/internal/cef_export.h"\n\n'+\
|
||||||
'#ifdef __cplusplus\n'+\
|
'#ifdef __cplusplus\n'+\
|
||||||
'extern "C" {\n'+\
|
'extern "C" {\n'+\
|
||||||
'#endif\n\n'+\
|
'#endif\n\n'+\
|
||||||
'#include "internal/cef_export.h"\n\n'+\
|
|
||||||
'// The API hash is created by analyzing CEF header files for C API type\n'+\
|
'// The API hash is created by analyzing CEF header files for C API type\n'+\
|
||||||
'// definitions. The hash value will change when header files are modified\n'+\
|
'// definitions. The hash value will change when header files are modified\n'+\
|
||||||
'// in a way that may cause binary incompatibility with other builds. The\n'+\
|
'// in a way that may cause binary incompatibility with other builds. The\n'+\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user