CEF changes
This commit is contained in:
BIN
3rd-party/CEF/SFXWiz32.exe
vendored
Normal file
BIN
3rd-party/CEF/SFXWiz32.exe
vendored
Normal file
Binary file not shown.
19
3rd-party/CEF/create_common.cmd
vendored
Normal file
19
3rd-party/CEF/create_common.cmd
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
@echo off
|
||||
pushd "%~dp0%"
|
||||
|
||||
mkdir automate
|
||||
mkdir chromium_git
|
||||
mkdir depot_tools
|
||||
|
||||
wget --no-check-certificate https://bitbucket.org/chromiumembedded/cef/raw/master/tools/automate/automate-git.py
|
||||
move /y automate-git.py automate\
|
||||
|
||||
wget --no-check-certificate https://storage.googleapis.com/chrome-infra/depot_tools.zip
|
||||
pushd depot_tools
|
||||
..\unzip ..\depot_tools.zip
|
||||
call update_depot_tools.bat
|
||||
popd
|
||||
del /q depot_tools.zip
|
||||
|
||||
popd
|
||||
pause
|
28
3rd-party/CEF/create_debug.cmd
vendored
Normal file
28
3rd-party/CEF/create_debug.cmd
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
@echo off
|
||||
set ROOT=%~dp0%
|
||||
pushd %ROOT%
|
||||
|
||||
set PATH=%ROOT%\depot_tools;%PATH%
|
||||
|
||||
pushd chromium_git
|
||||
set CEF_USE_GN=1
|
||||
set GN_DEFINES=is_win_fastlink=true
|
||||
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
|
||||
call python ..\automate\automate-git.py --download-dir=%ROOT%\chromium_git --depot-tools-dir=%ROOT%\depot_tools --no-distrib --no-build
|
||||
popd
|
||||
pause
|
||||
|
||||
pushd chromium_git\chromium\src\cef
|
||||
set CEF_USE_GN=1
|
||||
set GN_DEFINES=is_win_fastlink=true
|
||||
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
|
||||
call cef_create_projects.bat
|
||||
popd
|
||||
pause
|
||||
|
||||
pushd chromium_git\chromium\src
|
||||
call ninja -C out\Debug_GN_x64 cef
|
||||
popd
|
||||
pause
|
||||
|
||||
popd
|
26
3rd-party/CEF/create_release.cmd
vendored
Normal file
26
3rd-party/CEF/create_release.cmd
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
@echo off
|
||||
set ROOT=%~dp0%
|
||||
pushd %ROOT%
|
||||
|
||||
set PATH=%ROOT%\depot_tools;%PATH%
|
||||
|
||||
pushd chromium_git
|
||||
set CEF_USE_GN=1
|
||||
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
|
||||
call python ..\automate\automate-git.py --download-dir=%ROOT%\chromium_git --depot-tools-dir=%ROOT%\depot_tools --no-distrib --no-build
|
||||
popd
|
||||
pause
|
||||
|
||||
pushd chromium_git\chromium\src\cef
|
||||
set CEF_USE_GN=1
|
||||
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
|
||||
call cef_create_projects.bat
|
||||
popd
|
||||
pause
|
||||
|
||||
pushd chromium_git\chromium\src
|
||||
call ninja -C out\Release_GN_x64 cef
|
||||
popd
|
||||
pause
|
||||
|
||||
popd
|
BIN
3rd-party/CEF/funzip.exe
vendored
Normal file
BIN
3rd-party/CEF/funzip.exe
vendored
Normal file
Binary file not shown.
BIN
3rd-party/CEF/libeay32.dll
vendored
Normal file
BIN
3rd-party/CEF/libeay32.dll
vendored
Normal file
Binary file not shown.
BIN
3rd-party/CEF/libiconv2.dll
vendored
Normal file
BIN
3rd-party/CEF/libiconv2.dll
vendored
Normal file
Binary file not shown.
BIN
3rd-party/CEF/libintl3.dll
vendored
Normal file
BIN
3rd-party/CEF/libintl3.dll
vendored
Normal file
Binary file not shown.
BIN
3rd-party/CEF/libssl32.dll
vendored
Normal file
BIN
3rd-party/CEF/libssl32.dll
vendored
Normal file
Binary file not shown.
BIN
3rd-party/CEF/unzip.exe
vendored
Normal file
BIN
3rd-party/CEF/unzip.exe
vendored
Normal file
Binary file not shown.
BIN
3rd-party/CEF/unzip32.dll
vendored
Normal file
BIN
3rd-party/CEF/unzip32.dll
vendored
Normal file
Binary file not shown.
BIN
3rd-party/CEF/unzipsfx.exe
vendored
Normal file
BIN
3rd-party/CEF/unzipsfx.exe
vendored
Normal file
Binary file not shown.
BIN
3rd-party/CEF/uzexampl.exe
vendored
Normal file
BIN
3rd-party/CEF/uzexampl.exe
vendored
Normal file
Binary file not shown.
BIN
3rd-party/CEF/wget.exe
vendored
Normal file
BIN
3rd-party/CEF/wget.exe
vendored
Normal file
Binary file not shown.
BIN
3rd-party/CEF/zipinfo.exe
vendored
Normal file
BIN
3rd-party/CEF/zipinfo.exe
vendored
Normal file
Binary file not shown.
208
3rd-party/CEF_3.2987.1594_g92fba9c/CMakeLists.txt
vendored
208
3rd-party/CEF_3.2987.1594_g92fba9c/CMakeLists.txt
vendored
@@ -1,208 +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.
|
||||
|
||||
# OVERVIEW
|
||||
#
|
||||
# CMake is a cross-platform open-source build system that can generate project
|
||||
# files in many different formats. It can be downloaded from
|
||||
# http://www.cmake.org or installed via a platform package manager.
|
||||
#
|
||||
# CMake-generated project formats that have been tested with this CEF binary
|
||||
# distribution include:
|
||||
#
|
||||
# Linux: Ninja, Unix Makefiles
|
||||
# Mac OS X: Ninja, Xcode 5+
|
||||
# Windows: Ninja, Visual Studio 2010+
|
||||
#
|
||||
# Ninja is a cross-platform open-source tool for running fast builds using
|
||||
# pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be
|
||||
# downloaded from http://martine.github.io/ninja/ or installed via a platform
|
||||
# package manager.
|
||||
#
|
||||
# CMAKE STRUCTURE
|
||||
#
|
||||
# This CEF binary distribution includes the following CMake files:
|
||||
#
|
||||
# CMakeLists.txt Bootstrap that sets up the CMake environment.
|
||||
# cmake/*.cmake CEF configuration files shared by all targets.
|
||||
# libcef_dll/CMakeLists.txt Defines the libcef_dll_wrapper target.
|
||||
# tests/*/CMakeLists.txt Defines the test application target.
|
||||
#
|
||||
# See the "TODO:" comments below for guidance on how to integrate this CEF
|
||||
# binary distribution into a new or existing CMake project.
|
||||
#
|
||||
# BUILD REQUIREMENTS
|
||||
#
|
||||
# The below requirements must be met to build this CEF binary distribution.
|
||||
#
|
||||
# - CMake version 2.8.12.1 or newer.
|
||||
#
|
||||
# - Linux requirements:
|
||||
# Currently supported distributions include Debian Wheezy, Ubuntu Precise, and
|
||||
# related. Ubuntu 14.04 64-bit is recommended. Newer versions will likely also
|
||||
# work but may not have been tested.
|
||||
# Required packages include:
|
||||
# build-essential
|
||||
# libgtk2.0-dev (required by the cefclient target only)
|
||||
# libgtkglext1-dev (required by the cefclient target only)
|
||||
#
|
||||
# - Mac OS X requirements:
|
||||
# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 7.2
|
||||
# and OS X 10.11 are recommended. The Xcode command-line tools must also be
|
||||
# installed. Only 64-bit builds are supported on OS X.
|
||||
#
|
||||
# - Windows requirements:
|
||||
# Visual Studio 2010 or newer building on Windows 7 or newer. Visual Studio
|
||||
# 2015 Update 2 and Windows 10 64-bit are recommended.
|
||||
#
|
||||
# BUILD EXAMPLES
|
||||
#
|
||||
# The below commands will generate project files and create a Debug build of all
|
||||
# CEF targets using CMake and the platform toolchain.
|
||||
#
|
||||
# Start by creating and entering the CMake build output directory:
|
||||
# > cd path/to/cef_binary_*
|
||||
# > mkdir build && cd build
|
||||
#
|
||||
# To perform a Linux build using a 32-bit CEF binary distribution on a 32-bit
|
||||
# Linux platform or a 64-bit CEF binary distribution on a 64-bit Linux platform:
|
||||
# Using Unix Makefiles:
|
||||
# > cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > make -j4 cefclient cefsimple
|
||||
#
|
||||
# Using Ninja:
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Mac OS X build using a 64-bit CEF binary distribution:
|
||||
# Using the Xcode IDE:
|
||||
# > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
|
||||
# Open build\cef.xcodeproj in Xcode and select Product > Build.
|
||||
#
|
||||
# Using Ninja:
|
||||
# > cmake -G "Ninja" -DPROJECT_ARCH="x86_64" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Windows build using a 32-bit CEF binary distribution:
|
||||
# Using the Visual Studio 2015 IDE:
|
||||
# > cmake -G "Visual Studio 14" ..
|
||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||
#
|
||||
# Using Ninja with Visual Studio 2015 command-line tools:
|
||||
# (this path may be different depending on your Visual Studio installation)
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Windows build using a 64-bit CEF binary distribution:
|
||||
# Using the Visual Studio 2015 IDE:
|
||||
# > cmake -G "Visual Studio 14 Win64" ..
|
||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||
#
|
||||
# Using Ninja with Visual Studio 2015 command-line tools:
|
||||
# (this path may be different depending on your Visual Studio installation)
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
|
||||
#
|
||||
# Global setup.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12.1)
|
||||
|
||||
# Only generate Debug and Release configuration types.
|
||||
set(CMAKE_CONFIGURATION_TYPES Debug Release)
|
||||
|
||||
# Project name.
|
||||
# TODO: Change this line to match your project name when you copy this file.
|
||||
project(cef)
|
||||
|
||||
# Use folders in the resulting project files.
|
||||
set_property(GLOBAL PROPERTY OS_FOLDERS ON)
|
||||
|
||||
|
||||
#
|
||||
# CEF_ROOT setup.
|
||||
# This variable must be set to locate the binary distribution.
|
||||
# TODO: Choose one of the below examples and comment out the rest.
|
||||
#
|
||||
|
||||
# Example 1: The current directory contains both the complete binary
|
||||
# distribution and your project.
|
||||
# A. Comment in these lines:
|
||||
#
|
||||
set(CEF_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake")
|
||||
|
||||
# Example 2: The binary distribution is in a separate directory from your
|
||||
# project. Locate the binary distribution using the CEF_ROOT CMake
|
||||
# variable.
|
||||
# A. Create a directory structure for your project like the following:
|
||||
# myproject/
|
||||
# CMakeLists.txt <= top-level CMake configuration
|
||||
# mytarget/
|
||||
# CMakeLists.txt <= CMake configuration for `mytarget`
|
||||
# ... other `mytarget` source files
|
||||
# B. Copy this file to "myproject/CMakeLists.txt" as the top-level CMake
|
||||
# configuration.
|
||||
# C. Create the target-specific "myproject/mytarget/CMakeLists.txt" file for
|
||||
# your application. See the included cefclient and cefsimple CMakeLists.txt
|
||||
# files as an example.
|
||||
# D. Comment in these lines:
|
||||
#
|
||||
# set(CEF_ROOT "c:/path/to/cef_binary_3.2704.xxxx.gyyyyyyy_windows32")
|
||||
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake")
|
||||
|
||||
# Example 3: The binary distribution is in a separate directory from your
|
||||
# project. Locate the binary distribution using the CEF_ROOT
|
||||
# environment variable.
|
||||
# A. Create a directory structure for your project like the following:
|
||||
# myproject/
|
||||
# CMakeLists.txt <= top-level CMake configuration
|
||||
# cmake/
|
||||
# FindCEF.cmake <= CEF CMake configuration entry point
|
||||
# mytarget/
|
||||
# CMakeLists.txt <= CMake configuration for `mytarget`
|
||||
# ... other `mytarget` source files
|
||||
# B. Copy this file to "myproject/CMakeLists.txt" as the top-level CMake
|
||||
# configuration.
|
||||
# C. Copy the cmake/FindCEF.cmake file to "myproject/cmake/FindCEF.cmake".
|
||||
# D. Create the target-specific "myproject/mytarget/CMakeLists.txt" file for
|
||||
# your application. See the included cefclient and cefsimple CMakeLists.txt
|
||||
# files as an example.
|
||||
# E. Set the CEF_ROOT environment variable before executing CMake. For example:
|
||||
# > set CEF_ROOT=c:\path\to\cef_binary_3.2704.xxxx.gyyyyyyy_windows32
|
||||
# F. Comment in these lines:
|
||||
#
|
||||
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
|
||||
#
|
||||
# Load the CEF configuration.
|
||||
#
|
||||
|
||||
# Execute FindCEF.cmake which must exist in CMAKE_MODULE_PATH.
|
||||
find_package(CEF REQUIRED)
|
||||
|
||||
|
||||
#
|
||||
# Define CEF-based targets.
|
||||
#
|
||||
|
||||
# Include the libcef_dll_wrapper target.
|
||||
# Comes from the libcef_dll/CMakeLists.txt file in the binary distribution
|
||||
# directory.
|
||||
add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
|
||||
|
||||
# Include application targets.
|
||||
# Comes from the <target>/CMakeLists.txt file in the current directory.
|
||||
# TODO: Change these lines to match your project target when you copy this file.
|
||||
add_subdirectory(tests/cefclient)
|
||||
add_subdirectory(tests/cefsimple)
|
||||
add_subdirectory(tests/gtest)
|
||||
add_subdirectory(tests/ceftests)
|
||||
|
||||
# Display configuration settings.
|
||||
PRINT_CEF_CONFIG()
|
29
3rd-party/CEF_3.2987.1594_g92fba9c/LICENSE.txt
vendored
29
3rd-party/CEF_3.2987.1594_g92fba9c/LICENSE.txt
vendored
@@ -1,29 +0,0 @@
|
||||
// Copyright (c) 2008-2014 Marshall A. Greenblatt. Portions Copyright (c)
|
||||
// 2006-2009 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.
|
154
3rd-party/CEF_3.2987.1594_g92fba9c/README.txt
vendored
154
3rd-party/CEF_3.2987.1594_g92fba9c/README.txt
vendored
@@ -1,154 +0,0 @@
|
||||
Chromium Embedded Framework (CEF) Standard Binary Distribution for Windows
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Date: March 16, 2017
|
||||
|
||||
CEF Version: 3.2987.1594.g92fba9c
|
||||
CEF URL: https://bitbucket.org/chromiumembedded/cef.git
|
||||
@92fba9ccdf48ee2a0e83eb7c41e04f1f68bd8cb4
|
||||
|
||||
Chromium Verison: 57.0.2987.98
|
||||
Chromium URL: https://chromium.googlesource.com/chromium/src.git
|
||||
@a6a06b78087c9fdb4b12fe0ac1b87fdc10179f8b
|
||||
|
||||
This distribution contains all components necessary to build and distribute an
|
||||
application using CEF on the Windows platform. Please see the LICENSING
|
||||
section of this document for licensing terms and conditions.
|
||||
|
||||
|
||||
CONTENTS
|
||||
--------
|
||||
|
||||
cmake Contains CMake configuration files shared by all targets.
|
||||
|
||||
Debug Contains libcef.dll, libcef.lib and other components required to
|
||||
build and run the debug version of CEF-based applications. By
|
||||
default these files should be placed in the same directory as the
|
||||
executable and will be copied there as part of the build process.
|
||||
|
||||
include Contains all required CEF header files.
|
||||
|
||||
libcef_dll Contains the source code for the libcef_dll_wrapper static library
|
||||
that all applications using the CEF C++ API must link against.
|
||||
|
||||
Release Contains libcef.dll, libcef.lib and other components required to
|
||||
build and run the release version of CEF-based applications. By
|
||||
default these files should be placed in the same directory as the
|
||||
executable and will be copied there as part of the build process.
|
||||
|
||||
Resources Contains resources required by libcef.dll. By default these files
|
||||
should be placed in the same directory as libcef.dll and will be
|
||||
copied there as part of the build process.
|
||||
|
||||
tests/ Directory of tests that demonstrate CEF usage.
|
||||
|
||||
cefclient Contains the cefclient sample application configured to build
|
||||
using the files in this distribution. This application demonstrates
|
||||
a wide range of CEF functionalities.
|
||||
|
||||
cefsimple Contains the cefsimple sample application configured to build
|
||||
using the files in this distribution. This application demonstrates
|
||||
the minimal functionality required to create a browser window.
|
||||
|
||||
ceftests Contains unit tests that exercise the CEF APIs.
|
||||
|
||||
gtest Contains the Google C++ Testing Framework used by the ceftests
|
||||
target.
|
||||
|
||||
shared Contains source code shared by the cefclient and ceftests targets.
|
||||
|
||||
|
||||
USAGE
|
||||
-----
|
||||
|
||||
Building using CMake:
|
||||
CMake can be used to generate project files in many different formats. See
|
||||
usage instructions at the top of the CMakeLists.txt file.
|
||||
|
||||
Please visit the CEF Website for additional usage information.
|
||||
|
||||
https://bitbucket.org/chromiumembedded/cef/
|
||||
|
||||
|
||||
REDISTRIBUTION
|
||||
--------------
|
||||
|
||||
This binary distribution contains the below components.
|
||||
|
||||
Required components:
|
||||
|
||||
The following components are required. CEF will not function without them.
|
||||
|
||||
* CEF core library.
|
||||
* libcef.dll
|
||||
|
||||
* Crash reporting library.
|
||||
* chrome_elf.dll
|
||||
|
||||
* Unicode support data.
|
||||
* icudtl.dat
|
||||
|
||||
* V8 snapshot data.
|
||||
* natives_blob.bin
|
||||
* snapshot_blob.bin
|
||||
|
||||
Optional components:
|
||||
|
||||
The following components are optional. If they are missing CEF will continue to
|
||||
run but any related functionality may become broken or disabled.
|
||||
|
||||
* Localized resources.
|
||||
Locale file loading can be disabled completely using
|
||||
CefSettings.pack_loading_disabled. The locales directory path can be
|
||||
customized using CefSettings.locales_dir_path.
|
||||
|
||||
* locales/
|
||||
Directory containing localized resources used by CEF, Chromium and Blink. A
|
||||
.pak file is loaded from this directory based on the CefSettings.locale
|
||||
value. Only configured locales need to be distributed. If no locale is
|
||||
configured the default locale of "en-US" will be used. Without these files
|
||||
arbitrary Web components may display incorrectly.
|
||||
|
||||
* Other resources.
|
||||
Pack file loading can be disabled completely using
|
||||
CefSettings.pack_loading_disabled. The resources directory path can be
|
||||
customized using CefSettings.resources_dir_path.
|
||||
|
||||
* cef.pak
|
||||
* cef_100_percent.pak
|
||||
* cef_200_percent.pak
|
||||
These files contain non-localized resources used by CEF, Chromium and Blink.
|
||||
Without these files arbitrary Web components may display incorrectly.
|
||||
|
||||
* cef_extensions.pak
|
||||
This file contains non-localized resources required for extension loading.
|
||||
Pass the `--disable-extensions` command-line flag to disable use of this
|
||||
file. Without this file components that depend on the extension system,
|
||||
such as the PDF viewer, will not function.
|
||||
|
||||
* devtools_resources.pak
|
||||
This file contains non-localized resources required for Chrome Developer
|
||||
Tools. Without this file Chrome Developer Tools will not function.
|
||||
|
||||
* Angle and Direct3D support.
|
||||
* d3dcompiler_43.dll (required for Windows XP)
|
||||
* d3dcompiler_47.dll (required for Windows Vista and newer)
|
||||
* libEGL.dll
|
||||
* libGLESv2.dll
|
||||
Without these files HTML5 accelerated content like 2D canvas, 3D CSS and WebGL
|
||||
will not function.
|
||||
|
||||
* Widevine CDM support.
|
||||
* widevinecdmadapter.dll
|
||||
Without this file playback of Widevine projected content will not function.
|
||||
See the CefRegisterWidevineCdm() function in cef_web_plugin.h for usage.
|
||||
|
||||
|
||||
LICENSING
|
||||
---------
|
||||
|
||||
The CEF project is BSD licensed. Please read the LICENSE.txt file included with
|
||||
this binary distribution for licensing terms and conditions. Other software
|
||||
included in this distribution is provided under other licenses. Please visit
|
||||
"about:credits" in a CEF-based application for complete Chromium and third-party
|
||||
licensing information.
|
BIN
3rd-party/CEF_3.2987.1594_g92fba9c/Resources/cef.pak
vendored
BIN
3rd-party/CEF_3.2987.1594_g92fba9c/Resources/cef.pak
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
735
3rd-party/CEF_3.2987.1594_g92fba9c/cef_paths.gypi
vendored
735
3rd-party/CEF_3.2987.1594_g92fba9c/cef_paths.gypi
vendored
@@ -1,735 +0,0 @@
|
||||
# Copyright (c) 2017 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.
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# This file was generated by the CEF translator tool and should not edited
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
|
||||
{
|
||||
'variables': {
|
||||
'autogen_cpp_includes': [
|
||||
'include/cef_app.h',
|
||||
'include/cef_auth_callback.h',
|
||||
'include/cef_browser.h',
|
||||
'include/cef_browser_process_handler.h',
|
||||
'include/cef_callback.h',
|
||||
'include/cef_client.h',
|
||||
'include/cef_command_line.h',
|
||||
'include/cef_context_menu_handler.h',
|
||||
'include/cef_cookie.h',
|
||||
'include/cef_crash_util.h',
|
||||
'include/cef_dialog_handler.h',
|
||||
'include/cef_display_handler.h',
|
||||
'include/cef_dom.h',
|
||||
'include/cef_download_handler.h',
|
||||
'include/cef_download_item.h',
|
||||
'include/cef_drag_data.h',
|
||||
'include/cef_drag_handler.h',
|
||||
'include/cef_file_util.h',
|
||||
'include/cef_find_handler.h',
|
||||
'include/cef_focus_handler.h',
|
||||
'include/cef_frame.h',
|
||||
'include/cef_geolocation.h',
|
||||
'include/cef_geolocation_handler.h',
|
||||
'include/cef_image.h',
|
||||
'include/cef_jsdialog_handler.h',
|
||||
'include/cef_keyboard_handler.h',
|
||||
'include/cef_life_span_handler.h',
|
||||
'include/cef_load_handler.h',
|
||||
'include/cef_menu_model.h',
|
||||
'include/cef_menu_model_delegate.h',
|
||||
'include/cef_navigation_entry.h',
|
||||
'include/cef_origin_whitelist.h',
|
||||
'include/cef_parser.h',
|
||||
'include/cef_path_util.h',
|
||||
'include/cef_print_handler.h',
|
||||
'include/cef_print_settings.h',
|
||||
'include/cef_process_message.h',
|
||||
'include/cef_process_util.h',
|
||||
'include/cef_render_handler.h',
|
||||
'include/cef_render_process_handler.h',
|
||||
'include/cef_request.h',
|
||||
'include/cef_request_context.h',
|
||||
'include/cef_request_context_handler.h',
|
||||
'include/cef_request_handler.h',
|
||||
'include/cef_resource_bundle.h',
|
||||
'include/cef_resource_bundle_handler.h',
|
||||
'include/cef_resource_handler.h',
|
||||
'include/cef_response.h',
|
||||
'include/cef_response_filter.h',
|
||||
'include/cef_scheme.h',
|
||||
'include/cef_ssl_info.h',
|
||||
'include/cef_ssl_status.h',
|
||||
'include/cef_stream.h',
|
||||
'include/cef_string_visitor.h',
|
||||
'include/cef_task.h',
|
||||
'include/cef_thread.h',
|
||||
'include/cef_trace.h',
|
||||
'include/cef_urlrequest.h',
|
||||
'include/cef_v8.h',
|
||||
'include/cef_values.h',
|
||||
'include/cef_waitable_event.h',
|
||||
'include/cef_web_plugin.h',
|
||||
'include/cef_x509_certificate.h',
|
||||
'include/cef_xml_reader.h',
|
||||
'include/cef_zip_reader.h',
|
||||
'include/test/cef_translator_test.h',
|
||||
'include/views/cef_box_layout.h',
|
||||
'include/views/cef_browser_view.h',
|
||||
'include/views/cef_browser_view_delegate.h',
|
||||
'include/views/cef_button.h',
|
||||
'include/views/cef_button_delegate.h',
|
||||
'include/views/cef_display.h',
|
||||
'include/views/cef_fill_layout.h',
|
||||
'include/views/cef_label_button.h',
|
||||
'include/views/cef_layout.h',
|
||||
'include/views/cef_menu_button.h',
|
||||
'include/views/cef_menu_button_delegate.h',
|
||||
'include/views/cef_panel.h',
|
||||
'include/views/cef_panel_delegate.h',
|
||||
'include/views/cef_scroll_view.h',
|
||||
'include/views/cef_textfield.h',
|
||||
'include/views/cef_textfield_delegate.h',
|
||||
'include/views/cef_view.h',
|
||||
'include/views/cef_view_delegate.h',
|
||||
'include/views/cef_window.h',
|
||||
'include/views/cef_window_delegate.h',
|
||||
],
|
||||
'autogen_capi_includes': [
|
||||
'include/capi/cef_app_capi.h',
|
||||
'include/capi/cef_auth_callback_capi.h',
|
||||
'include/capi/cef_browser_capi.h',
|
||||
'include/capi/cef_browser_process_handler_capi.h',
|
||||
'include/capi/cef_callback_capi.h',
|
||||
'include/capi/cef_client_capi.h',
|
||||
'include/capi/cef_command_line_capi.h',
|
||||
'include/capi/cef_context_menu_handler_capi.h',
|
||||
'include/capi/cef_cookie_capi.h',
|
||||
'include/capi/cef_crash_util_capi.h',
|
||||
'include/capi/cef_dialog_handler_capi.h',
|
||||
'include/capi/cef_display_handler_capi.h',
|
||||
'include/capi/cef_dom_capi.h',
|
||||
'include/capi/cef_download_handler_capi.h',
|
||||
'include/capi/cef_download_item_capi.h',
|
||||
'include/capi/cef_drag_data_capi.h',
|
||||
'include/capi/cef_drag_handler_capi.h',
|
||||
'include/capi/cef_file_util_capi.h',
|
||||
'include/capi/cef_find_handler_capi.h',
|
||||
'include/capi/cef_focus_handler_capi.h',
|
||||
'include/capi/cef_frame_capi.h',
|
||||
'include/capi/cef_geolocation_capi.h',
|
||||
'include/capi/cef_geolocation_handler_capi.h',
|
||||
'include/capi/cef_image_capi.h',
|
||||
'include/capi/cef_jsdialog_handler_capi.h',
|
||||
'include/capi/cef_keyboard_handler_capi.h',
|
||||
'include/capi/cef_life_span_handler_capi.h',
|
||||
'include/capi/cef_load_handler_capi.h',
|
||||
'include/capi/cef_menu_model_capi.h',
|
||||
'include/capi/cef_menu_model_delegate_capi.h',
|
||||
'include/capi/cef_navigation_entry_capi.h',
|
||||
'include/capi/cef_origin_whitelist_capi.h',
|
||||
'include/capi/cef_parser_capi.h',
|
||||
'include/capi/cef_path_util_capi.h',
|
||||
'include/capi/cef_print_handler_capi.h',
|
||||
'include/capi/cef_print_settings_capi.h',
|
||||
'include/capi/cef_process_message_capi.h',
|
||||
'include/capi/cef_process_util_capi.h',
|
||||
'include/capi/cef_render_handler_capi.h',
|
||||
'include/capi/cef_render_process_handler_capi.h',
|
||||
'include/capi/cef_request_capi.h',
|
||||
'include/capi/cef_request_context_capi.h',
|
||||
'include/capi/cef_request_context_handler_capi.h',
|
||||
'include/capi/cef_request_handler_capi.h',
|
||||
'include/capi/cef_resource_bundle_capi.h',
|
||||
'include/capi/cef_resource_bundle_handler_capi.h',
|
||||
'include/capi/cef_resource_handler_capi.h',
|
||||
'include/capi/cef_response_capi.h',
|
||||
'include/capi/cef_response_filter_capi.h',
|
||||
'include/capi/cef_scheme_capi.h',
|
||||
'include/capi/cef_ssl_info_capi.h',
|
||||
'include/capi/cef_ssl_status_capi.h',
|
||||
'include/capi/cef_stream_capi.h',
|
||||
'include/capi/cef_string_visitor_capi.h',
|
||||
'include/capi/cef_task_capi.h',
|
||||
'include/capi/cef_thread_capi.h',
|
||||
'include/capi/cef_trace_capi.h',
|
||||
'include/capi/cef_urlrequest_capi.h',
|
||||
'include/capi/cef_v8_capi.h',
|
||||
'include/capi/cef_values_capi.h',
|
||||
'include/capi/cef_waitable_event_capi.h',
|
||||
'include/capi/cef_web_plugin_capi.h',
|
||||
'include/capi/cef_x509_certificate_capi.h',
|
||||
'include/capi/cef_xml_reader_capi.h',
|
||||
'include/capi/cef_zip_reader_capi.h',
|
||||
'include/capi/test/cef_translator_test_capi.h',
|
||||
'include/capi/views/cef_box_layout_capi.h',
|
||||
'include/capi/views/cef_browser_view_capi.h',
|
||||
'include/capi/views/cef_browser_view_delegate_capi.h',
|
||||
'include/capi/views/cef_button_capi.h',
|
||||
'include/capi/views/cef_button_delegate_capi.h',
|
||||
'include/capi/views/cef_display_capi.h',
|
||||
'include/capi/views/cef_fill_layout_capi.h',
|
||||
'include/capi/views/cef_label_button_capi.h',
|
||||
'include/capi/views/cef_layout_capi.h',
|
||||
'include/capi/views/cef_menu_button_capi.h',
|
||||
'include/capi/views/cef_menu_button_delegate_capi.h',
|
||||
'include/capi/views/cef_panel_capi.h',
|
||||
'include/capi/views/cef_panel_delegate_capi.h',
|
||||
'include/capi/views/cef_scroll_view_capi.h',
|
||||
'include/capi/views/cef_textfield_capi.h',
|
||||
'include/capi/views/cef_textfield_delegate_capi.h',
|
||||
'include/capi/views/cef_view_capi.h',
|
||||
'include/capi/views/cef_view_delegate_capi.h',
|
||||
'include/capi/views/cef_window_capi.h',
|
||||
'include/capi/views/cef_window_delegate_capi.h',
|
||||
],
|
||||
'autogen_library_side': [
|
||||
'libcef_dll/ctocpp/app_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/app_ctocpp.h',
|
||||
'libcef_dll/cpptoc/auth_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/auth_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/before_download_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/before_download_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/binary_value_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/binary_value_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/box_layout_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/box_layout_cpptoc.h',
|
||||
'libcef_dll/cpptoc/browser_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/browser_cpptoc.h',
|
||||
'libcef_dll/cpptoc/browser_host_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/browser_host_cpptoc.h',
|
||||
'libcef_dll/ctocpp/browser_process_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/browser_process_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/browser_view_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/browser_view_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/button_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/button_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/button_delegate_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/button_delegate_ctocpp.h',
|
||||
'libcef_dll/cpptoc/callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/client_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/client_ctocpp.h',
|
||||
'libcef_dll/cpptoc/command_line_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/command_line_cpptoc.h',
|
||||
'libcef_dll/ctocpp/completion_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/completion_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/context_menu_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/context_menu_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/context_menu_params_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/context_menu_params_cpptoc.h',
|
||||
'libcef_dll/cpptoc/cookie_manager_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/cookie_manager_cpptoc.h',
|
||||
'libcef_dll/ctocpp/cookie_visitor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/cookie_visitor_ctocpp.h',
|
||||
'libcef_dll/cpptoc/domdocument_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/domdocument_cpptoc.h',
|
||||
'libcef_dll/cpptoc/domnode_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/domnode_cpptoc.h',
|
||||
'libcef_dll/ctocpp/domvisitor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
||||
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/dialog_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/dialog_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/dictionary_value_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/dictionary_value_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/display_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/display_cpptoc.h',
|
||||
'libcef_dll/ctocpp/display_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/display_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/download_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/download_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/download_image_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/download_image_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/download_item_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/download_item_cpptoc.h',
|
||||
'libcef_dll/cpptoc/download_item_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/download_item_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/drag_data_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/drag_data_cpptoc.h',
|
||||
'libcef_dll/ctocpp/drag_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/drag_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/end_tracing_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/end_tracing_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/file_dialog_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/file_dialog_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/fill_layout_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/fill_layout_cpptoc.h',
|
||||
'libcef_dll/ctocpp/find_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/find_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/focus_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/focus_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/frame_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/frame_cpptoc.h',
|
||||
'libcef_dll/cpptoc/geolocation_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/geolocation_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/geolocation_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/geolocation_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/image_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/image_cpptoc.h',
|
||||
'libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/jsdialog_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/jsdialog_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/keyboard_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/keyboard_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/label_button_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/label_button_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/layout_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/layout_cpptoc.h',
|
||||
'libcef_dll/ctocpp/life_span_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/life_span_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/list_value_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/list_value_cpptoc.h',
|
||||
'libcef_dll/ctocpp/load_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/load_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/menu_button_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/menu_button_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.h',
|
||||
'libcef_dll/cpptoc/menu_model_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/menu_model_cpptoc.h',
|
||||
'libcef_dll/ctocpp/menu_model_delegate_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/menu_model_delegate_ctocpp.h',
|
||||
'libcef_dll/cpptoc/navigation_entry_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/navigation_entry_cpptoc.h',
|
||||
'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/panel_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/panel_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/panel_delegate_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/panel_delegate_ctocpp.h',
|
||||
'libcef_dll/ctocpp/pdf_print_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/pdf_print_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/post_data_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/post_data_cpptoc.h',
|
||||
'libcef_dll/cpptoc/post_data_element_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/post_data_element_cpptoc.h',
|
||||
'libcef_dll/cpptoc/print_dialog_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/print_dialog_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/print_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/print_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/print_job_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/print_job_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/print_settings_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/print_settings_cpptoc.h',
|
||||
'libcef_dll/cpptoc/process_message_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/process_message_cpptoc.h',
|
||||
'libcef_dll/ctocpp/read_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/read_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/register_cdm_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/register_cdm_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/render_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/render_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/render_process_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/render_process_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/request_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/request_cpptoc.h',
|
||||
'libcef_dll/cpptoc/request_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/request_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/request_context_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/request_context_cpptoc.h',
|
||||
'libcef_dll/ctocpp/request_context_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/request_context_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/request_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/request_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/resolve_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/resolve_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/resource_bundle_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/resource_bundle_cpptoc.h',
|
||||
'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/resource_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/resource_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/response_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/response_cpptoc.h',
|
||||
'libcef_dll/ctocpp/response_filter_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/response_filter_ctocpp.h',
|
||||
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/sslinfo_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/sslinfo_cpptoc.h',
|
||||
'libcef_dll/cpptoc/sslstatus_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/sslstatus_cpptoc.h',
|
||||
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h',
|
||||
'libcef_dll/cpptoc/scheme_registrar_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/scheme_registrar_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/scroll_view_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/scroll_view_cpptoc.h',
|
||||
'libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/set_cookie_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/set_cookie_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/stream_reader_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/stream_reader_cpptoc.h',
|
||||
'libcef_dll/cpptoc/stream_writer_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/stream_writer_cpptoc.h',
|
||||
'libcef_dll/ctocpp/string_visitor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/string_visitor_ctocpp.h',
|
||||
'libcef_dll/ctocpp/task_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/task_ctocpp.h',
|
||||
'libcef_dll/cpptoc/task_runner_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/task_runner_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/textfield_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/textfield_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/textfield_delegate_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/textfield_delegate_ctocpp.h',
|
||||
'libcef_dll/cpptoc/thread_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/thread_cpptoc.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_cpptoc.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_ctocpp.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_child_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_child_ctocpp.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_cpptoc.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_cpptoc.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_child_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_child_cpptoc.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_scoped_client_child_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_scoped_client_child_ctocpp.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.h',
|
||||
'libcef_dll/cpptoc/urlrequest_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/urlrequest_cpptoc.h',
|
||||
'libcef_dll/ctocpp/urlrequest_client_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/urlrequest_client_ctocpp.h',
|
||||
'libcef_dll/ctocpp/v8accessor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8accessor_ctocpp.h',
|
||||
'libcef_dll/cpptoc/v8context_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8context_cpptoc.h',
|
||||
'libcef_dll/cpptoc/v8exception_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8exception_cpptoc.h',
|
||||
'libcef_dll/ctocpp/v8handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/v8interceptor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8interceptor_ctocpp.h',
|
||||
'libcef_dll/cpptoc/v8stack_frame_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8stack_frame_cpptoc.h',
|
||||
'libcef_dll/cpptoc/v8stack_trace_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8stack_trace_cpptoc.h',
|
||||
'libcef_dll/cpptoc/v8value_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8value_cpptoc.h',
|
||||
'libcef_dll/cpptoc/value_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/value_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/view_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/view_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/view_delegate_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/view_delegate_ctocpp.h',
|
||||
'libcef_dll/cpptoc/waitable_event_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/waitable_event_cpptoc.h',
|
||||
'libcef_dll/cpptoc/web_plugin_info_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/web_plugin_info_cpptoc.h',
|
||||
'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h',
|
||||
'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/window_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/window_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/window_delegate_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/window_delegate_ctocpp.h',
|
||||
'libcef_dll/ctocpp/write_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/write_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/x509cert_principal_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/x509cert_principal_cpptoc.h',
|
||||
'libcef_dll/cpptoc/x509certificate_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/x509certificate_cpptoc.h',
|
||||
'libcef_dll/cpptoc/xml_reader_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/xml_reader_cpptoc.h',
|
||||
'libcef_dll/cpptoc/zip_reader_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/zip_reader_cpptoc.h',
|
||||
],
|
||||
'autogen_client_side': [
|
||||
'libcef_dll/cpptoc/app_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/app_cpptoc.h',
|
||||
'libcef_dll/ctocpp/auth_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/auth_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/before_download_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/before_download_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/binary_value_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/binary_value_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/box_layout_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/box_layout_ctocpp.h',
|
||||
'libcef_dll/ctocpp/browser_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/browser_ctocpp.h',
|
||||
'libcef_dll/ctocpp/browser_host_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/browser_host_ctocpp.h',
|
||||
'libcef_dll/cpptoc/browser_process_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/browser_process_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/browser_view_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/browser_view_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/button_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/button_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/button_delegate_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/button_delegate_cpptoc.h',
|
||||
'libcef_dll/ctocpp/callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/client_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/client_cpptoc.h',
|
||||
'libcef_dll/ctocpp/command_line_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/command_line_ctocpp.h',
|
||||
'libcef_dll/cpptoc/completion_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/completion_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/context_menu_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/context_menu_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/context_menu_params_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/context_menu_params_ctocpp.h',
|
||||
'libcef_dll/ctocpp/cookie_manager_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/cookie_manager_ctocpp.h',
|
||||
'libcef_dll/cpptoc/cookie_visitor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/cookie_visitor_cpptoc.h',
|
||||
'libcef_dll/ctocpp/domdocument_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/domdocument_ctocpp.h',
|
||||
'libcef_dll/ctocpp/domnode_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/domnode_ctocpp.h',
|
||||
'libcef_dll/cpptoc/domvisitor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
||||
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/dialog_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/dialog_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/dictionary_value_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/dictionary_value_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/display_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/display_ctocpp.h',
|
||||
'libcef_dll/cpptoc/display_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/display_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/download_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/download_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/download_image_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/download_image_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/download_item_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/download_item_ctocpp.h',
|
||||
'libcef_dll/ctocpp/download_item_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/download_item_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/drag_data_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/drag_data_ctocpp.h',
|
||||
'libcef_dll/cpptoc/drag_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/drag_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/end_tracing_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/end_tracing_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/file_dialog_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/file_dialog_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/fill_layout_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/fill_layout_ctocpp.h',
|
||||
'libcef_dll/cpptoc/find_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/find_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/focus_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/focus_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/frame_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/frame_ctocpp.h',
|
||||
'libcef_dll/ctocpp/geolocation_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/geolocation_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/geolocation_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/geolocation_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/image_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/image_ctocpp.h',
|
||||
'libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/jsdialog_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/jsdialog_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/keyboard_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/keyboard_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/label_button_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/label_button_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/layout_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/layout_ctocpp.h',
|
||||
'libcef_dll/cpptoc/life_span_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/life_span_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/list_value_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/list_value_ctocpp.h',
|
||||
'libcef_dll/cpptoc/load_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/load_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/menu_button_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/menu_button_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h',
|
||||
'libcef_dll/ctocpp/menu_model_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/menu_model_ctocpp.h',
|
||||
'libcef_dll/cpptoc/menu_model_delegate_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/menu_model_delegate_cpptoc.h',
|
||||
'libcef_dll/ctocpp/navigation_entry_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/navigation_entry_ctocpp.h',
|
||||
'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/panel_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/panel_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/panel_delegate_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/panel_delegate_cpptoc.h',
|
||||
'libcef_dll/cpptoc/pdf_print_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/pdf_print_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/post_data_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/post_data_ctocpp.h',
|
||||
'libcef_dll/ctocpp/post_data_element_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/post_data_element_ctocpp.h',
|
||||
'libcef_dll/ctocpp/print_dialog_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/print_dialog_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/print_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/print_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/print_job_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/print_job_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/print_settings_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/print_settings_ctocpp.h',
|
||||
'libcef_dll/ctocpp/process_message_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/process_message_ctocpp.h',
|
||||
'libcef_dll/cpptoc/read_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/read_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/register_cdm_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/register_cdm_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/render_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/render_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/render_process_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/render_process_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/request_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/request_ctocpp.h',
|
||||
'libcef_dll/ctocpp/request_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/request_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/request_context_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/request_context_ctocpp.h',
|
||||
'libcef_dll/cpptoc/request_context_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/request_context_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/request_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/request_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/resolve_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/resolve_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/resource_bundle_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/resource_bundle_ctocpp.h',
|
||||
'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/resource_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/resource_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/response_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/response_ctocpp.h',
|
||||
'libcef_dll/cpptoc/response_filter_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/response_filter_cpptoc.h',
|
||||
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/sslinfo_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/sslinfo_ctocpp.h',
|
||||
'libcef_dll/ctocpp/sslstatus_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/sslstatus_ctocpp.h',
|
||||
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h',
|
||||
'libcef_dll/ctocpp/scheme_registrar_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/scheme_registrar_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/scroll_view_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/scroll_view_ctocpp.h',
|
||||
'libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/set_cookie_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/set_cookie_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/stream_reader_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/stream_reader_ctocpp.h',
|
||||
'libcef_dll/ctocpp/stream_writer_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/stream_writer_ctocpp.h',
|
||||
'libcef_dll/cpptoc/string_visitor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/string_visitor_cpptoc.h',
|
||||
'libcef_dll/cpptoc/task_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/task_cpptoc.h',
|
||||
'libcef_dll/ctocpp/task_runner_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/task_runner_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/textfield_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/textfield_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/textfield_delegate_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/textfield_delegate_cpptoc.h',
|
||||
'libcef_dll/ctocpp/thread_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/thread_ctocpp.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_ctocpp.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_cpptoc.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_child_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_child_cpptoc.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_ctocpp.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_ctocpp.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_child_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_child_ctocpp.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.h',
|
||||
'libcef_dll/cpptoc/test/translator_test_scoped_client_child_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/test/translator_test_scoped_client_child_cpptoc.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.h',
|
||||
'libcef_dll/ctocpp/test/translator_test_scoped_library_child_child_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/test/translator_test_scoped_library_child_child_ctocpp.h',
|
||||
'libcef_dll/ctocpp/urlrequest_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/urlrequest_ctocpp.h',
|
||||
'libcef_dll/cpptoc/urlrequest_client_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/urlrequest_client_cpptoc.h',
|
||||
'libcef_dll/cpptoc/v8accessor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8accessor_cpptoc.h',
|
||||
'libcef_dll/ctocpp/v8context_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8context_ctocpp.h',
|
||||
'libcef_dll/ctocpp/v8exception_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8exception_ctocpp.h',
|
||||
'libcef_dll/cpptoc/v8handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/v8interceptor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8interceptor_cpptoc.h',
|
||||
'libcef_dll/ctocpp/v8stack_frame_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8stack_frame_ctocpp.h',
|
||||
'libcef_dll/ctocpp/v8stack_trace_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8stack_trace_ctocpp.h',
|
||||
'libcef_dll/ctocpp/v8value_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8value_ctocpp.h',
|
||||
'libcef_dll/ctocpp/value_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/value_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/view_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/view_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/view_delegate_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/view_delegate_cpptoc.h',
|
||||
'libcef_dll/ctocpp/waitable_event_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/waitable_event_ctocpp.h',
|
||||
'libcef_dll/ctocpp/web_plugin_info_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/web_plugin_info_ctocpp.h',
|
||||
'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h',
|
||||
'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/window_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/window_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/window_delegate_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/window_delegate_cpptoc.h',
|
||||
'libcef_dll/cpptoc/write_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/write_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/x509cert_principal_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/x509cert_principal_ctocpp.h',
|
||||
'libcef_dll/ctocpp/x509certificate_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/x509certificate_ctocpp.h',
|
||||
'libcef_dll/ctocpp/xml_reader_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/xml_reader_ctocpp.h',
|
||||
'libcef_dll/ctocpp/zip_reader_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/zip_reader_ctocpp.h',
|
||||
],
|
||||
},
|
||||
}
|
528
3rd-party/CEF_3.2987.1594_g92fba9c/cef_paths2.gypi
vendored
528
3rd-party/CEF_3.2987.1594_g92fba9c/cef_paths2.gypi
vendored
@@ -1,528 +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.
|
||||
|
||||
{
|
||||
'variables': {
|
||||
'includes_common': [
|
||||
'include/base/cef_atomic_ref_count.h',
|
||||
'include/base/cef_atomicops.h',
|
||||
'include/base/cef_basictypes.h',
|
||||
'include/base/cef_bind.h',
|
||||
'include/base/cef_bind_helpers.h',
|
||||
'include/base/cef_build.h',
|
||||
'include/base/cef_callback.h',
|
||||
'include/base/cef_callback_forward.h',
|
||||
'include/base/cef_callback_helpers.h',
|
||||
'include/base/cef_callback_list.h',
|
||||
'include/base/cef_cancelable_callback.h',
|
||||
'include/base/cef_lock.h',
|
||||
'include/base/cef_logging.h',
|
||||
'include/base/cef_macros.h',
|
||||
'include/base/cef_move.h',
|
||||
'include/base/cef_platform_thread.h',
|
||||
'include/base/cef_ref_counted.h',
|
||||
'include/base/cef_scoped_ptr.h',
|
||||
'include/base/cef_string16.h',
|
||||
'include/base/cef_template_util.h',
|
||||
'include/base/cef_thread_checker.h',
|
||||
'include/base/cef_thread_collision_warner.h',
|
||||
'include/base/cef_trace_event.h',
|
||||
'include/base/cef_tuple.h',
|
||||
'include/base/cef_weak_ptr.h',
|
||||
'include/base/internal/cef_bind_internal.h',
|
||||
'include/base/internal/cef_callback_internal.h',
|
||||
'include/base/internal/cef_lock_impl.h',
|
||||
'include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h',
|
||||
'include/base/internal/cef_thread_checker_impl.h',
|
||||
'include/cef_base.h',
|
||||
'include/cef_version.h',
|
||||
'include/internal/cef_export.h',
|
||||
'include/internal/cef_logging_internal.h',
|
||||
'include/internal/cef_ptr.h',
|
||||
'include/internal/cef_string.h',
|
||||
'include/internal/cef_string_list.h',
|
||||
'include/internal/cef_string_map.h',
|
||||
'include/internal/cef_string_multimap.h',
|
||||
'include/internal/cef_string_types.h',
|
||||
'include/internal/cef_string_wrappers.h',
|
||||
'include/internal/cef_thread_internal.h',
|
||||
'include/internal/cef_time.h',
|
||||
'include/internal/cef_trace_event_internal.h',
|
||||
'include/internal/cef_types.h',
|
||||
'include/internal/cef_types_wrappers.h',
|
||||
],
|
||||
'includes_capi': [
|
||||
'include/capi/cef_base_capi.h',
|
||||
],
|
||||
'includes_wrapper': [
|
||||
'include/wrapper/cef_byte_read_handler.h',
|
||||
'include/wrapper/cef_closure_task.h',
|
||||
'include/wrapper/cef_helpers.h',
|
||||
'include/wrapper/cef_message_router.h',
|
||||
'include/wrapper/cef_resource_manager.h',
|
||||
'include/wrapper/cef_scoped_temp_dir.h',
|
||||
'include/wrapper/cef_stream_resource_handler.h',
|
||||
'include/wrapper/cef_xml_object.h',
|
||||
'include/wrapper/cef_zip_archive.h',
|
||||
],
|
||||
'includes_win': [
|
||||
'include/base/internal/cef_atomicops_x86_msvc.h',
|
||||
'include/base/internal/cef_bind_internal_win.h',
|
||||
'include/cef_sandbox_win.h',
|
||||
'include/internal/cef_types_win.h',
|
||||
'include/internal/cef_win.h',
|
||||
],
|
||||
'includes_mac': [
|
||||
'include/base/internal/cef_atomicops_atomicword_compat.h',
|
||||
'include/base/internal/cef_atomicops_mac.h',
|
||||
'include/cef_application_mac.h',
|
||||
'include/internal/cef_mac.h',
|
||||
'include/internal/cef_types_mac.h',
|
||||
],
|
||||
'includes_linux': [
|
||||
'include/base/internal/cef_atomicops_atomicword_compat.h',
|
||||
'include/base/internal/cef_atomicops_arm_gcc.h',
|
||||
'include/base/internal/cef_atomicops_x86_gcc.h',
|
||||
'include/internal/cef_linux.h',
|
||||
'include/internal/cef_types_linux.h',
|
||||
],
|
||||
'libcef_sources_common': [
|
||||
'libcef_dll/cpptoc/cpptoc_ref_counted.h',
|
||||
'libcef_dll/cpptoc/cpptoc_scoped.h',
|
||||
'libcef_dll/ctocpp/base_ref_counted_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/base_ref_counted_ctocpp.h',
|
||||
'libcef_dll/ctocpp/base_scoped_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/base_scoped_ctocpp.h',
|
||||
'libcef_dll/ctocpp/ctocpp_ref_counted.h',
|
||||
'libcef_dll/ctocpp/ctocpp_scoped.h',
|
||||
'libcef_dll/libcef_dll.cc',
|
||||
'libcef_dll/libcef_dll2.cc',
|
||||
'libcef_dll/ptr_util.h',
|
||||
'libcef_dll/resource.h',
|
||||
'libcef_dll/transfer_util.cc',
|
||||
'libcef_dll/transfer_util.h',
|
||||
'libcef_dll/wrapper_types.h',
|
||||
],
|
||||
'libcef_dll_wrapper_sources_base': [
|
||||
'libcef_dll/base/cef_atomicops_x86_gcc.cc',
|
||||
'libcef_dll/base/cef_bind_helpers.cc',
|
||||
'libcef_dll/base/cef_callback_helpers.cc',
|
||||
'libcef_dll/base/cef_callback_internal.cc',
|
||||
'libcef_dll/base/cef_lock.cc',
|
||||
'libcef_dll/base/cef_lock_impl.cc',
|
||||
'libcef_dll/base/cef_logging.cc',
|
||||
'libcef_dll/base/cef_ref_counted.cc',
|
||||
'libcef_dll/base/cef_string16.cc',
|
||||
'libcef_dll/base/cef_thread_checker_impl.cc',
|
||||
'libcef_dll/base/cef_thread_collision_warner.cc',
|
||||
'libcef_dll/base/cef_weak_ptr.cc',
|
||||
],
|
||||
'libcef_dll_wrapper_sources_common': [
|
||||
'libcef_dll/cpptoc/base_ref_counted_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/base_ref_counted_cpptoc.h',
|
||||
'libcef_dll/cpptoc/base_scoped_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/base_scoped_cpptoc.h',
|
||||
'libcef_dll/cpptoc/cpptoc_ref_counted.h',
|
||||
'libcef_dll/cpptoc/cpptoc_scoped.h',
|
||||
'libcef_dll/ctocpp/ctocpp_ref_counted.h',
|
||||
'libcef_dll/ctocpp/ctocpp_scoped.h',
|
||||
'libcef_dll/ptr_util.h',
|
||||
'libcef_dll/transfer_util.cc',
|
||||
'libcef_dll/transfer_util.h',
|
||||
'libcef_dll/wrapper_types.h',
|
||||
'libcef_dll/wrapper/cef_browser_info_map.h',
|
||||
'libcef_dll/wrapper/cef_byte_read_handler.cc',
|
||||
'libcef_dll/wrapper/cef_closure_task.cc',
|
||||
'libcef_dll/wrapper/cef_message_router.cc',
|
||||
'libcef_dll/wrapper/cef_resource_manager.cc',
|
||||
'libcef_dll/wrapper/cef_scoped_temp_dir.cc',
|
||||
'libcef_dll/wrapper/cef_stream_resource_handler.cc',
|
||||
'libcef_dll/wrapper/cef_xml_object.cc',
|
||||
'libcef_dll/wrapper/cef_zip_archive.cc',
|
||||
'libcef_dll/wrapper/libcef_dll_wrapper.cc',
|
||||
'libcef_dll/wrapper/libcef_dll_wrapper2.cc',
|
||||
],
|
||||
'shared_sources_browser': [
|
||||
'tests/shared/browser/client_app_browser.cc',
|
||||
'tests/shared/browser/client_app_browser.h',
|
||||
'tests/shared/browser/geometry_util.cc',
|
||||
'tests/shared/browser/geometry_util.h',
|
||||
'tests/shared/browser/main_message_loop.cc',
|
||||
'tests/shared/browser/main_message_loop.h',
|
||||
'tests/shared/browser/main_message_loop_external_pump.cc',
|
||||
'tests/shared/browser/main_message_loop_external_pump.h',
|
||||
'tests/shared/browser/main_message_loop_std.cc',
|
||||
'tests/shared/browser/main_message_loop_std.h',
|
||||
'tests/shared/browser/resource_util.h',
|
||||
'tests/shared/browser/resource_util.cc',
|
||||
'tests/shared/browser/resource_util.h',
|
||||
],
|
||||
'shared_sources_common': [
|
||||
'tests/shared/common/client_app.cc',
|
||||
'tests/shared/common/client_app.h',
|
||||
'tests/shared/common/client_app_other.cc',
|
||||
'tests/shared/common/client_app_other.h',
|
||||
'tests/shared/common/client_switches.cc',
|
||||
'tests/shared/common/client_switches.h',
|
||||
],
|
||||
'shared_sources_renderer': [
|
||||
'tests/shared/renderer/client_app_renderer.cc',
|
||||
'tests/shared/renderer/client_app_renderer.h',
|
||||
],
|
||||
'shared_sources_resources': [
|
||||
'tests/shared/resources/osr_test.html',
|
||||
'tests/shared/resources/pdf.html',
|
||||
'tests/shared/resources/pdf.pdf',
|
||||
'tests/shared/resources/window_icon.1x.png',
|
||||
'tests/shared/resources/window_icon.2x.png',
|
||||
],
|
||||
'shared_sources_linux': [
|
||||
'tests/shared/browser/main_message_loop_external_pump_linux.cc',
|
||||
'tests/shared/browser/resource_util_posix.cc',
|
||||
],
|
||||
'shared_sources_mac': [
|
||||
'tests/shared/browser/main_message_loop_external_pump_mac.mm',
|
||||
'tests/shared/browser/resource_util_mac.mm',
|
||||
'tests/shared/browser/resource_util_posix.cc',
|
||||
],
|
||||
'shared_sources_mac_helper': [
|
||||
'tests/shared/process_helper_mac.cc',
|
||||
],
|
||||
'shared_sources_win': [
|
||||
'tests/shared/browser/main_message_loop_external_pump_win.cc',
|
||||
'tests/shared/browser/resource_util_win.cc',
|
||||
'tests/shared/browser/util_win.cc',
|
||||
'tests/shared/browser/util_win.h',
|
||||
],
|
||||
'cefclient_sources_browser': [
|
||||
'tests/cefclient/browser/binding_test.cc',
|
||||
'tests/cefclient/browser/binding_test.h',
|
||||
'tests/cefclient/browser/browser_window.cc',
|
||||
'tests/cefclient/browser/browser_window.h',
|
||||
'tests/cefclient/browser/bytes_write_handler.cc',
|
||||
'tests/cefclient/browser/bytes_write_handler.h',
|
||||
'tests/cefclient/browser/client_app_delegates_browser.cc',
|
||||
'tests/cefclient/browser/client_browser.cc',
|
||||
'tests/cefclient/browser/client_browser.h',
|
||||
'tests/cefclient/browser/client_handler.cc',
|
||||
'tests/cefclient/browser/client_handler.h',
|
||||
'tests/cefclient/browser/client_handler_osr.cc',
|
||||
'tests/cefclient/browser/client_handler_osr.h',
|
||||
'tests/cefclient/browser/client_handler_std.cc',
|
||||
'tests/cefclient/browser/client_handler_std.h',
|
||||
'tests/cefclient/browser/client_types.h',
|
||||
'tests/cefclient/browser/dialog_test.cc',
|
||||
'tests/cefclient/browser/dialog_test.h',
|
||||
'tests/cefclient/browser/drm_test.cc',
|
||||
'tests/cefclient/browser/drm_test.h',
|
||||
'tests/cefclient/browser/main_context.cc',
|
||||
'tests/cefclient/browser/main_context.h',
|
||||
'tests/cefclient/browser/main_context_impl.cc',
|
||||
'tests/cefclient/browser/main_context_impl.h',
|
||||
'tests/cefclient/browser/osr_dragdrop_events.h',
|
||||
'tests/cefclient/browser/osr_renderer.h',
|
||||
'tests/cefclient/browser/osr_renderer.cc',
|
||||
'tests/cefclient/browser/preferences_test.cc',
|
||||
'tests/cefclient/browser/preferences_test.h',
|
||||
'tests/cefclient/browser/resource.h',
|
||||
'tests/cefclient/browser/response_filter_test.cc',
|
||||
'tests/cefclient/browser/response_filter_test.h',
|
||||
'tests/cefclient/browser/root_window.cc',
|
||||
'tests/cefclient/browser/root_window.h',
|
||||
'tests/cefclient/browser/root_window_create.cc',
|
||||
'tests/cefclient/browser/root_window_manager.cc',
|
||||
'tests/cefclient/browser/root_window_manager.h',
|
||||
'tests/cefclient/browser/scheme_test.cc',
|
||||
'tests/cefclient/browser/scheme_test.h',
|
||||
'tests/cefclient/browser/temp_window.h',
|
||||
'tests/cefclient/browser/test_runner.cc',
|
||||
'tests/cefclient/browser/test_runner.h',
|
||||
'tests/cefclient/browser/urlrequest_test.cc',
|
||||
'tests/cefclient/browser/urlrequest_test.h',
|
||||
'tests/cefclient/browser/window_test.cc',
|
||||
'tests/cefclient/browser/window_test.h',
|
||||
'tests/cefclient/browser/window_test_runner.cc',
|
||||
'tests/cefclient/browser/window_test_runner.h',
|
||||
],
|
||||
'cefclient_sources_common': [
|
||||
'tests/cefclient/common/client_app_delegates_common.cc',
|
||||
'tests/cefclient/common/scheme_test_common.cc',
|
||||
'tests/cefclient/common/scheme_test_common.h',
|
||||
],
|
||||
'cefclient_sources_renderer': [
|
||||
'tests/cefclient/renderer/client_app_delegates_renderer.cc',
|
||||
'tests/cefclient/renderer/client_renderer.cc',
|
||||
'tests/cefclient/renderer/client_renderer.h',
|
||||
'tests/cefclient/renderer/performance_test.cc',
|
||||
'tests/cefclient/renderer/performance_test.h',
|
||||
'tests/cefclient/renderer/performance_test_setup.h',
|
||||
'tests/cefclient/renderer/performance_test_tests.cc',
|
||||
],
|
||||
'cefclient_sources_resources': [
|
||||
'tests/cefclient/resources/binding.html',
|
||||
'tests/cefclient/resources/dialogs.html',
|
||||
'tests/cefclient/resources/draggable.html',
|
||||
'tests/cefclient/resources/drm.html',
|
||||
'tests/cefclient/resources/localstorage.html',
|
||||
'tests/cefclient/resources/logo.png',
|
||||
'tests/cefclient/resources/menu_icon.1x.png',
|
||||
'tests/cefclient/resources/menu_icon.2x.png',
|
||||
'tests/cefclient/resources/other_tests.html',
|
||||
'tests/cefclient/resources/performance.html',
|
||||
'tests/cefclient/resources/performance2.html',
|
||||
'tests/cefclient/resources/preferences.html',
|
||||
'tests/cefclient/resources/response_filter.html',
|
||||
'tests/cefclient/resources/transparency.html',
|
||||
'tests/cefclient/resources/urlrequest.html',
|
||||
'tests/cefclient/resources/window.html',
|
||||
'tests/cefclient/resources/xmlhttprequest.html',
|
||||
],
|
||||
'cefclient_sources_win': [
|
||||
'tests/cefclient/browser/browser_window_osr_win.cc',
|
||||
'tests/cefclient/browser/browser_window_osr_win.h',
|
||||
'tests/cefclient/browser/browser_window_std_win.cc',
|
||||
'tests/cefclient/browser/browser_window_std_win.h',
|
||||
'tests/cefclient/browser/main_context_impl_win.cc',
|
||||
'tests/cefclient/browser/main_message_loop_multithreaded_win.cc',
|
||||
'tests/cefclient/browser/main_message_loop_multithreaded_win.h',
|
||||
'tests/cefclient/browser/osr_dragdrop_win.cc',
|
||||
'tests/cefclient/browser/osr_dragdrop_win.h',
|
||||
'tests/cefclient/browser/osr_ime_handler_win.cc',
|
||||
'tests/cefclient/browser/osr_ime_handler_win.h',
|
||||
'tests/cefclient/browser/osr_window_win.cc',
|
||||
'tests/cefclient/browser/osr_window_win.h',
|
||||
'tests/cefclient/browser/resource_util_win_idmap.cc',
|
||||
'tests/cefclient/browser/root_window_views.cc',
|
||||
'tests/cefclient/browser/root_window_views.h',
|
||||
'tests/cefclient/browser/root_window_win.cc',
|
||||
'tests/cefclient/browser/root_window_win.h',
|
||||
'tests/cefclient/browser/temp_window_win.cc',
|
||||
'tests/cefclient/browser/temp_window_win.h',
|
||||
'tests/cefclient/browser/views_menu_bar.cc',
|
||||
'tests/cefclient/browser/views_menu_bar.h',
|
||||
'tests/cefclient/browser/views_style.cc',
|
||||
'tests/cefclient/browser/views_style.h',
|
||||
'tests/cefclient/browser/views_window.cc',
|
||||
'tests/cefclient/browser/views_window.h',
|
||||
'tests/cefclient/browser/window_test_runner_views.cc',
|
||||
'tests/cefclient/browser/window_test_runner_views.h',
|
||||
'tests/cefclient/browser/window_test_runner_win.cc',
|
||||
'tests/cefclient/browser/window_test_runner_win.h',
|
||||
'tests/cefclient/cefclient_win.cc',
|
||||
'tests/cefclient/resources/win/cefclient.exe.manifest',
|
||||
'tests/cefclient/resources/win/cefclient.ico',
|
||||
'tests/cefclient/resources/win/cefclient.rc',
|
||||
'tests/cefclient/resources/win/small.ico',
|
||||
],
|
||||
'cefclient_sources_mac': [
|
||||
'tests/cefclient/browser/browser_window_osr_mac.h',
|
||||
'tests/cefclient/browser/browser_window_osr_mac.mm',
|
||||
'tests/cefclient/browser/browser_window_std_mac.h',
|
||||
'tests/cefclient/browser/browser_window_std_mac.mm',
|
||||
'tests/cefclient/browser/main_context_impl_posix.cc',
|
||||
'tests/cefclient/browser/root_window_mac.h',
|
||||
'tests/cefclient/browser/root_window_mac.mm',
|
||||
'tests/cefclient/browser/temp_window_mac.h',
|
||||
'tests/cefclient/browser/temp_window_mac.mm',
|
||||
'tests/cefclient/browser/text_input_client_osr_mac.h',
|
||||
'tests/cefclient/browser/text_input_client_osr_mac.mm',
|
||||
'tests/cefclient/browser/window_test_runner_mac.h',
|
||||
'tests/cefclient/browser/window_test_runner_mac.mm',
|
||||
'tests/cefclient/cefclient_mac.mm',
|
||||
],
|
||||
'cefclient_bundle_resources_mac': [
|
||||
'tests/cefclient/resources/mac/cefclient.icns',
|
||||
'tests/cefclient/resources/mac/English.lproj/InfoPlist.strings',
|
||||
'tests/cefclient/resources/mac/English.lproj/MainMenu.xib',
|
||||
'tests/cefclient/resources/mac/Info.plist',
|
||||
],
|
||||
'cefclient_sources_linux': [
|
||||
'tests/cefclient/browser/browser_window_osr_gtk.cc',
|
||||
'tests/cefclient/browser/browser_window_osr_gtk.h',
|
||||
'tests/cefclient/browser/browser_window_std_gtk.cc',
|
||||
'tests/cefclient/browser/browser_window_std_gtk.h',
|
||||
'tests/cefclient/browser/dialog_handler_gtk.cc',
|
||||
'tests/cefclient/browser/dialog_handler_gtk.h',
|
||||
'tests/cefclient/browser/main_context_impl_posix.cc',
|
||||
'tests/cefclient/browser/print_handler_gtk.cc',
|
||||
'tests/cefclient/browser/print_handler_gtk.h',
|
||||
'tests/cefclient/browser/resource_util_linux.cc',
|
||||
'tests/cefclient/browser/root_window_gtk.cc',
|
||||
'tests/cefclient/browser/root_window_gtk.h',
|
||||
'tests/cefclient/browser/root_window_views.cc',
|
||||
'tests/cefclient/browser/root_window_views.h',
|
||||
'tests/cefclient/browser/temp_window_x11.cc',
|
||||
'tests/cefclient/browser/temp_window_x11.h',
|
||||
'tests/cefclient/browser/views_menu_bar.cc',
|
||||
'tests/cefclient/browser/views_menu_bar.h',
|
||||
'tests/cefclient/browser/views_style.cc',
|
||||
'tests/cefclient/browser/views_style.h',
|
||||
'tests/cefclient/browser/views_window.cc',
|
||||
'tests/cefclient/browser/views_window.h',
|
||||
'tests/cefclient/browser/window_test_runner_gtk.cc',
|
||||
'tests/cefclient/browser/window_test_runner_gtk.h',
|
||||
'tests/cefclient/browser/window_test_runner_views.cc',
|
||||
'tests/cefclient/browser/window_test_runner_views.h',
|
||||
'tests/cefclient/cefclient_gtk.cc',
|
||||
],
|
||||
'cefsimple_sources_common': [
|
||||
'tests/cefsimple/simple_app.cc',
|
||||
'tests/cefsimple/simple_app.h',
|
||||
'tests/cefsimple/simple_handler.cc',
|
||||
'tests/cefsimple/simple_handler.h',
|
||||
],
|
||||
'cefsimple_sources_win': [
|
||||
'tests/cefsimple/cefsimple.exe.manifest',
|
||||
'tests/cefsimple/cefsimple.rc',
|
||||
'tests/cefsimple/cefsimple_win.cc',
|
||||
'tests/cefsimple/simple_handler_win.cc',
|
||||
'tests/cefsimple/resource.h',
|
||||
'tests/cefsimple/res/cefsimple.ico',
|
||||
'tests/cefsimple/res/small.ico',
|
||||
],
|
||||
'cefsimple_sources_mac': [
|
||||
'tests/cefsimple/cefsimple_mac.mm',
|
||||
'tests/cefsimple/simple_handler_mac.mm',
|
||||
],
|
||||
'cefsimple_sources_mac_helper': [
|
||||
'tests/cefsimple/process_helper_mac.cc',
|
||||
],
|
||||
'cefsimple_bundle_resources_mac': [
|
||||
'tests/cefsimple/mac/cefsimple.icns',
|
||||
'tests/cefsimple/mac/English.lproj/InfoPlist.strings',
|
||||
'tests/cefsimple/mac/English.lproj/MainMenu.xib',
|
||||
'tests/cefsimple/mac/Info.plist',
|
||||
],
|
||||
'cefsimple_sources_linux': [
|
||||
'tests/cefsimple/cefsimple_linux.cc',
|
||||
'tests/cefsimple/simple_handler_linux.cc',
|
||||
],
|
||||
'ceftests_sources_common': [
|
||||
'tests/ceftests/browser_info_map_unittest.cc',
|
||||
'tests/ceftests/command_line_unittest.cc',
|
||||
'tests/ceftests/cookie_unittest.cc',
|
||||
'tests/ceftests/dialog_unittest.cc',
|
||||
'tests/ceftests/display_unittest.cc',
|
||||
'tests/ceftests/dom_unittest.cc',
|
||||
'tests/ceftests/download_unittest.cc',
|
||||
'tests/ceftests/draggable_regions_unittest.cc',
|
||||
'tests/ceftests/file_util.cc',
|
||||
'tests/ceftests/file_util.h',
|
||||
'tests/ceftests/file_util_unittest.cc',
|
||||
'tests/ceftests/frame_unittest.cc',
|
||||
'tests/ceftests/geolocation_unittest.cc',
|
||||
'tests/ceftests/image_unittest.cc',
|
||||
'tests/ceftests/image_util.cc',
|
||||
'tests/ceftests/image_util.h',
|
||||
'tests/ceftests/jsdialog_unittest.cc',
|
||||
'tests/ceftests/life_span_unittest.cc',
|
||||
'tests/ceftests/message_router_unittest.cc',
|
||||
'tests/ceftests/navigation_unittest.cc',
|
||||
'tests/ceftests/os_rendering_unittest.cc',
|
||||
'tests/ceftests/parser_unittest.cc',
|
||||
'tests/ceftests/plugin_unittest.cc',
|
||||
'tests/ceftests/preference_unittest.cc',
|
||||
'tests/ceftests/print_unittest.cc',
|
||||
'tests/ceftests/process_message_unittest.cc',
|
||||
'tests/ceftests/request_context_unittest.cc',
|
||||
'tests/ceftests/request_handler_unittest.cc',
|
||||
'tests/ceftests/request_unittest.cc',
|
||||
'tests/ceftests/resource.h',
|
||||
'tests/ceftests/resource_manager_unittest.cc',
|
||||
'tests/ceftests/routing_test_handler.cc',
|
||||
'tests/ceftests/routing_test_handler.h',
|
||||
'tests/ceftests/run_all_unittests.cc',
|
||||
'tests/ceftests/scheme_handler_unittest.cc',
|
||||
'tests/ceftests/scoped_temp_dir_unittest.cc',
|
||||
'tests/ceftests/stream_unittest.cc',
|
||||
'tests/ceftests/stream_resource_handler_unittest.cc',
|
||||
'tests/ceftests/string_unittest.cc',
|
||||
'tests/ceftests/client_app_delegates.cc',
|
||||
'tests/ceftests/task_unittest.cc',
|
||||
'tests/ceftests/test_handler.cc',
|
||||
'tests/ceftests/test_handler.h',
|
||||
'tests/ceftests/test_suite.cc',
|
||||
'tests/ceftests/test_suite.h',
|
||||
'tests/ceftests/test_util.cc',
|
||||
'tests/ceftests/test_util.h',
|
||||
'tests/ceftests/thread_helper.cc',
|
||||
'tests/ceftests/thread_helper.h',
|
||||
'tests/ceftests/thread_unittest.cc',
|
||||
'tests/ceftests/tracing_unittest.cc',
|
||||
'tests/ceftests/translator_unittest.cc',
|
||||
'tests/ceftests/urlrequest_unittest.cc',
|
||||
'tests/ceftests/v8_unittest.cc',
|
||||
'tests/ceftests/values_unittest.cc',
|
||||
'tests/ceftests/version_unittest.cc',
|
||||
'tests/ceftests/waitable_event_unittest.cc',
|
||||
'tests/ceftests/webui_unittest.cc',
|
||||
'tests/ceftests/xml_reader_unittest.cc',
|
||||
'tests/ceftests/zip_reader_unittest.cc',
|
||||
],
|
||||
'ceftests_sources_views': [
|
||||
'tests/ceftests/views/button_unittest.cc',
|
||||
'tests/ceftests/views/panel_unittest.cc',
|
||||
'tests/ceftests/views/scroll_view_unittest.cc',
|
||||
'tests/ceftests/views/test_window_delegate.cc',
|
||||
'tests/ceftests/views/test_window_delegate.h',
|
||||
'tests/ceftests/views/textfield_unittest.cc',
|
||||
'tests/ceftests/views/window_unittest.cc',
|
||||
],
|
||||
'ceftests_sources_win': [
|
||||
'tests/ceftests/resource_util_win_idmap.cc',
|
||||
'tests/ceftests/resources/win/ceftests.exe.manifest',
|
||||
'tests/ceftests/resources/win/ceftests.ico',
|
||||
'tests/ceftests/resources/win/ceftests.rc',
|
||||
'tests/ceftests/resources/win/small.ico',
|
||||
],
|
||||
'ceftests_sources_mac': [
|
||||
'tests/ceftests/os_rendering_unittest_mac.h',
|
||||
'tests/ceftests/os_rendering_unittest_mac.mm',
|
||||
'tests/ceftests/run_all_unittests_mac.mm',
|
||||
],
|
||||
'ceftests_sources_mac_helper': [
|
||||
'tests/shared/browser/resource_util.cc',
|
||||
'tests/shared/browser/resource_util.h',
|
||||
'tests/shared/browser/resource_util_mac.mm',
|
||||
'tests/shared/browser/resource_util_posix.cc',
|
||||
'tests/ceftests/client_app_delegates.cc',
|
||||
'tests/ceftests/cookie_unittest.cc',
|
||||
'tests/ceftests/dom_unittest.cc',
|
||||
'tests/ceftests/file_util.cc',
|
||||
'tests/ceftests/file_util.h',
|
||||
'tests/ceftests/frame_unittest.cc',
|
||||
'tests/ceftests/message_router_unittest.cc',
|
||||
'tests/ceftests/navigation_unittest.cc',
|
||||
'tests/ceftests/plugin_unittest.cc',
|
||||
'tests/ceftests/preference_unittest.cc',
|
||||
'tests/ceftests/process_message_unittest.cc',
|
||||
'tests/ceftests/request_handler_unittest.cc',
|
||||
'tests/ceftests/request_unittest.cc',
|
||||
'tests/ceftests/routing_test_handler.cc',
|
||||
'tests/ceftests/routing_test_handler.h',
|
||||
'tests/ceftests/scheme_handler_unittest.cc',
|
||||
'tests/ceftests/urlrequest_unittest.cc',
|
||||
'tests/ceftests/test_handler.cc',
|
||||
'tests/ceftests/test_handler.h',
|
||||
'tests/ceftests/test_suite.cc',
|
||||
'tests/ceftests/test_suite.h',
|
||||
'tests/ceftests/test_util.cc',
|
||||
'tests/ceftests/test_util.h',
|
||||
'tests/ceftests/thread_helper.cc',
|
||||
'tests/ceftests/thread_helper.h',
|
||||
'tests/ceftests/thread_unittest.cc',
|
||||
'tests/ceftests/tracing_unittest.cc',
|
||||
'tests/ceftests/v8_unittest.cc',
|
||||
],
|
||||
'ceftests_bundle_resources_mac': [
|
||||
'tests/ceftests/resources/mac/ceftests.icns',
|
||||
'tests/ceftests/resources/mac/English.lproj/InfoPlist.strings',
|
||||
'tests/ceftests/resources/mac/English.lproj/MainMenu.xib',
|
||||
'tests/ceftests/resources/mac/Info.plist',
|
||||
],
|
||||
'ceftests_sources_linux': [
|
||||
'tests/ceftests/resource_util_linux.cc',
|
||||
],
|
||||
},
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
# Copyright (c) 2016 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.
|
||||
|
||||
#
|
||||
# This file is the CEF CMake configuration entry point and should be loaded
|
||||
# using `find_package(CEF REQUIRED)`. See the top-level CMakeLists.txt file
|
||||
# included with the CEF binary distribution for usage information.
|
||||
#
|
||||
|
||||
# Find the CEF binary distribution root directory.
|
||||
set(_CEF_ROOT "")
|
||||
if(CEF_ROOT AND IS_DIRECTORY "${CEF_ROOT}")
|
||||
set(_CEF_ROOT "${CEF_ROOT}")
|
||||
set(_CEF_ROOT_EXPLICIT 1)
|
||||
else()
|
||||
set(_ENV_CEF_ROOT "")
|
||||
if(DEFINED ENV{CEF_ROOT})
|
||||
file(TO_CMAKE_PATH "$ENV{CEF_ROOT}" _ENV_CEF_ROOT)
|
||||
endif()
|
||||
if(_ENV_CEF_ROOT AND IS_DIRECTORY "${_ENV_CEF_ROOT}")
|
||||
set(_CEF_ROOT "${_ENV_CEF_ROOT}")
|
||||
set(_CEF_ROOT_EXPLICIT 1)
|
||||
endif()
|
||||
unset(_ENV_CEF_ROOT)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED _CEF_ROOT_EXPLICIT)
|
||||
message(FATAL_ERROR "Must specify a CEF_ROOT value via CMake or environment variable.")
|
||||
endif()
|
||||
|
||||
if(NOT IS_DIRECTORY "${_CEF_ROOT}/cmake")
|
||||
message(FATAL_ERROR "No CMake bootstrap found for CEF binary distribution at: ${CEF_ROOT}.")
|
||||
endif()
|
||||
|
||||
# Execute additional cmake files from the CEF binary distribution.
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CEF_ROOT}/cmake")
|
||||
include("cef_variables")
|
||||
include("cef_macros")
|
@@ -1,370 +0,0 @@
|
||||
# Copyright (c) 2016 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.
|
||||
|
||||
# Must be loaded via FindCEF.cmake.
|
||||
if(NOT DEFINED _CEF_ROOT_EXPLICIT)
|
||||
message(FATAL_ERROR "Use find_package(CEF) to load this file.")
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Shared macros.
|
||||
#
|
||||
|
||||
# Print the current CEF configuration.
|
||||
macro(PRINT_CEF_CONFIG)
|
||||
message(STATUS "*** CEF CONFIGURATION SETTINGS ***")
|
||||
message(STATUS "Generator: ${CMAKE_GENERATOR}")
|
||||
message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}")
|
||||
message(STATUS "Project architecture: ${PROJECT_ARCH}")
|
||||
|
||||
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
||||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Binary distribution root: ${_CEF_ROOT}")
|
||||
|
||||
if(OS_MACOSX)
|
||||
message(STATUS "Base SDK: ${CMAKE_OSX_SYSROOT}")
|
||||
message(STATUS "Target SDK: ${CEF_TARGET_SDK}")
|
||||
endif()
|
||||
|
||||
if(OS_WINDOWS)
|
||||
message(STATUS "CEF Windows sandbox: ${USE_SANDBOX}")
|
||||
message(STATUS "Visual Studio ATL support: ${USE_ATL}")
|
||||
endif()
|
||||
|
||||
set(_libraries ${CEF_STANDARD_LIBS})
|
||||
if(OS_WINDOWS AND USE_SANDBOX)
|
||||
list(APPEND _libraries ${CEF_SANDBOX_STANDARD_LIBS})
|
||||
endif()
|
||||
message(STATUS "Standard libraries: ${_libraries}")
|
||||
|
||||
message(STATUS "Compile defines: ${CEF_COMPILER_DEFINES}")
|
||||
message(STATUS "Compile defines (Debug): ${CEF_COMPILER_DEFINES_DEBUG}")
|
||||
message(STATUS "Compile defines (Release): ${CEF_COMPILER_DEFINES_RELEASE}")
|
||||
message(STATUS "C compile flags: ${CEF_COMPILER_FLAGS} ${CEF_C_COMPILER_FLAGS}")
|
||||
message(STATUS "C compile flags (Debug): ${CEF_COMPILER_FLAGS_DEBUG} ${CEF_C_COMPILER_FLAGS_DEBUG}")
|
||||
message(STATUS "C compile flags (Release): ${CEF_COMPILER_FLAGS_RELEASE} ${CEF_C_COMPILER_FLAGS_RELEASE}")
|
||||
message(STATUS "C++ compile flags: ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS}")
|
||||
message(STATUS "C++ compile flags (Debug): ${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}")
|
||||
message(STATUS "C++ compile flags (Release): ${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}")
|
||||
message(STATUS "Exe link flags: ${CEF_LINKER_FLAGS} ${CEF_EXE_LINKER_FLAGS}")
|
||||
message(STATUS "Exe link flags (Debug): ${CEF_LINKER_FLAGS_DEBUG} ${CEF_EXE_LINKER_FLAGS_DEBUG}")
|
||||
message(STATUS "Exe link flags (Release): ${CEF_LINKER_FLAGS_RELEASE} ${CEF_EXE_LINKER_FLAGS_RELEASE}")
|
||||
message(STATUS "Shared link flags: ${CEF_LINKER_FLAGS} ${CEF_SHARED_LINKER_FLAGS}")
|
||||
message(STATUS "Shared link flags (Debug): ${CEF_LINKER_FLAGS_DEBUG} ${CEF_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
message(STATUS "Shared link flags (Release): ${CEF_LINKER_FLAGS_RELEASE} ${CEF_SHARED_LINKER_FLAGS_RELEASE}")
|
||||
|
||||
if(OS_LINUX OR OS_WINDOWS)
|
||||
message(STATUS "CEF Binary files: ${CEF_BINARY_FILES}")
|
||||
message(STATUS "CEF Resource files: ${CEF_RESOURCE_FILES}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Append platform specific sources to a list of sources.
|
||||
macro(APPEND_PLATFORM_SOURCES name_of_list)
|
||||
if(OS_LINUX AND ${name_of_list}_LINUX)
|
||||
list(APPEND ${name_of_list} ${${name_of_list}_LINUX})
|
||||
endif()
|
||||
if(OS_POSIX AND ${name_of_list}_POSIX)
|
||||
list(APPEND ${name_of_list} ${${name_of_list}_POSIX})
|
||||
endif()
|
||||
if(OS_WINDOWS AND ${name_of_list}_WINDOWS)
|
||||
list(APPEND ${name_of_list} ${${name_of_list}_WINDOWS})
|
||||
endif()
|
||||
if(OS_MACOSX AND ${name_of_list}_MACOSX)
|
||||
list(APPEND ${name_of_list} ${${name_of_list}_MACOSX})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Determine the target output directory based on platform and generator.
|
||||
macro(SET_CEF_TARGET_OUT_DIR)
|
||||
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR
|
||||
${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
||||
# By default Ninja and Make builds don't create a subdirectory named after
|
||||
# the configuration.
|
||||
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
|
||||
|
||||
# Output binaries (executables, libraries) to the correct directory.
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
|
||||
else()
|
||||
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Copy a list of files from one directory to another. Relative files paths are maintained.
|
||||
# The path component of the source |file_list| will be removed.
|
||||
macro(COPY_FILES target file_list source_dir target_dir)
|
||||
foreach(FILENAME ${file_list})
|
||||
set(source_file ${source_dir}/${FILENAME})
|
||||
get_filename_component(target_name ${FILENAME} NAME)
|
||||
set(target_file ${target_dir}/${target_name})
|
||||
if(IS_DIRECTORY ${source_file})
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_file}" "${target_file}"
|
||||
VERBATIM
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${source_file}" "${target_file}"
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
#
|
||||
# Linux macros.
|
||||
#
|
||||
|
||||
if(OS_LINUX)
|
||||
|
||||
# Use pkg-config to find Linux libraries and update compiler/linker variables.
|
||||
macro(FIND_LINUX_LIBRARIES libraries)
|
||||
# Read pkg-config info into variables.
|
||||
execute_process(COMMAND pkg-config --cflags ${libraries} OUTPUT_VARIABLE FLL_CFLAGS)
|
||||
execute_process(COMMAND pkg-config --libs-only-L --libs-only-other ${libraries} OUTPUT_VARIABLE FLL_LDFLAGS)
|
||||
execute_process(COMMAND pkg-config --libs-only-l ${libraries} OUTPUT_VARIABLE FLL_LIBS)
|
||||
|
||||
# Strip leading and trailing whitepspace.
|
||||
STRING(STRIP "${FLL_CFLAGS}" FLL_CFLAGS)
|
||||
STRING(STRIP "${FLL_LDFLAGS}" FLL_LDFLAGS)
|
||||
STRING(STRIP "${FLL_LIBS}" FLL_LIBS)
|
||||
|
||||
# Convert to a list.
|
||||
separate_arguments(FLL_CFLAGS)
|
||||
separate_arguments(FLL_LDFLAGS)
|
||||
separate_arguments(FLL_LIBS)
|
||||
|
||||
# Update build variables.
|
||||
list(APPEND CEF_C_COMPILER_FLAGS ${FLL_CFLAGS})
|
||||
list(APPEND CEF_CXX_COMPILER_FLAGS ${FLL_CFLAGS})
|
||||
list(APPEND CEF_EXE_LINKER_FLAGS ${FLL_LDFLAGS})
|
||||
list(APPEND CEF_SHARED_LINKER_FLAGS ${FLL_LDFLAGS})
|
||||
list(APPEND CEF_STANDARD_LIBS ${FLL_LIBS})
|
||||
endmacro()
|
||||
|
||||
# Set SUID permissions on the specified executable.
|
||||
macro(SET_LINUX_SUID_PERMISSIONS target executable)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E echo ""
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "*** Run the following command manually to set SUID permissions ***"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "EXE=\"${executable}\" && sudo -- chown root:root $EXE && sudo -- chmod 4755 $EXE"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo ""
|
||||
VERBATIM
|
||||
)
|
||||
endmacro()
|
||||
|
||||
endif(OS_LINUX)
|
||||
|
||||
|
||||
#
|
||||
# Mac OS X macros.
|
||||
#
|
||||
|
||||
if(OS_MACOSX)
|
||||
|
||||
# Fix the framework rpath in the helper executable.
|
||||
macro(FIX_MACOSX_HELPER_FRAMEWORK_RPATH target)
|
||||
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
|
||||
# so set rpath up to Contents/ so that the loader can find Frameworks/.
|
||||
set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/../../../..")
|
||||
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
endmacro()
|
||||
|
||||
# Fix the framework rpath in the main executable.
|
||||
macro(FIX_MACOSX_MAIN_FRAMEWORK_RPATH target)
|
||||
# The main app is at $app_name.app/Contents/MacOS/$app_name
|
||||
# so set rpath up to Contents/ so that the loader can find Frameworks/.
|
||||
set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/..")
|
||||
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
endmacro()
|
||||
|
||||
# Manually process and copy over resource files.
|
||||
macro(COPY_MACOSX_RESOURCES resource_list prefix_list target source_dir app_path)
|
||||
foreach(FILENAME ${resource_list})
|
||||
# Remove one or more prefixes from the source paths.
|
||||
set(TARGET_FILENAME "${FILENAME}")
|
||||
foreach(PREFIX ${prefix_list})
|
||||
string(REGEX REPLACE "^.*${PREFIX}" "" TARGET_FILENAME ${TARGET_FILENAME})
|
||||
endforeach()
|
||||
|
||||
# Determine the absolute source and target paths.
|
||||
set(TARGET_PATH "${app_path}/Contents/Resources/${TARGET_FILENAME}")
|
||||
if(IS_ABSOLUTE ${FILENAME})
|
||||
set(SOURCE_PATH ${FILENAME})
|
||||
else()
|
||||
set(SOURCE_PATH "${source_dir}/${FILENAME}")
|
||||
endif()
|
||||
|
||||
if(${FILENAME} MATCHES ".xib$")
|
||||
# Change the target file extension.
|
||||
string(REGEX REPLACE ".xib$" ".nib" TARGET_PATH ${TARGET_PATH})
|
||||
|
||||
get_filename_component(TARGET_DIRECTORY ${TARGET_PATH} PATH)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
# Create the target directory.
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${TARGET_DIRECTORY}"
|
||||
# Compile the XIB file to a NIB.
|
||||
COMMAND /usr/bin/ibtool --output-format binary1 --compile "${TARGET_PATH}" "${SOURCE_PATH}"
|
||||
VERBATIM
|
||||
)
|
||||
elseif(NOT ${TARGET_FILENAME} STREQUAL "Info.plist")
|
||||
# Copy the file as-is.
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_PATH}" "${TARGET_PATH}"
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
endif(OS_MACOSX)
|
||||
|
||||
|
||||
#
|
||||
# Windows macros.
|
||||
#
|
||||
|
||||
if(OS_WINDOWS)
|
||||
|
||||
# Add custom manifest files to an executable target.
|
||||
macro(ADD_WINDOWS_MANIFEST manifest_path target extension)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND "mt.exe" -nologo
|
||||
-manifest \"${manifest_path}/${target}.${extension}.manifest\" \"${manifest_path}/compatibility.manifest\"
|
||||
-outputresource:"${CEF_TARGET_OUT_DIR}/${target}.${extension}"\;\#1
|
||||
COMMENT "Adding manifest..."
|
||||
)
|
||||
endmacro()
|
||||
|
||||
endif(OS_WINDOWS)
|
||||
|
||||
|
||||
#
|
||||
# Target configuration macros.
|
||||
#
|
||||
|
||||
# Add a logical target that can be used to link the specified libraries into an
|
||||
# executable target.
|
||||
macro(ADD_LOGICAL_TARGET target debug_lib release_lib)
|
||||
add_library(${target} ${CEF_LIBTYPE} IMPORTED)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
IMPORTED_LOCATION "${release_lib}"
|
||||
IMPORTED_LOCATION_DEBUG "${debug_lib}"
|
||||
IMPORTED_LOCATION_RELEASE "${release_lib}"
|
||||
)
|
||||
endmacro()
|
||||
|
||||
# Set common target properties. Use SET_LIBRARY_TARGET_PROPERTIES() or
|
||||
# SET_EXECUTABLE_TARGET_PROPERTIES() instead of calling this macro directly.
|
||||
macro(SET_COMMON_TARGET_PROPERTIES target)
|
||||
# Compile flags.
|
||||
target_compile_options(${target} PUBLIC ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS})
|
||||
target_compile_options(${target} PUBLIC $<$<CONFIG:Debug>:${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}>)
|
||||
target_compile_options(${target} PUBLIC $<$<CONFIG:Release>:${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}>)
|
||||
|
||||
# Compile definitions.
|
||||
target_compile_definitions(${target} PUBLIC ${CEF_COMPILER_DEFINES})
|
||||
target_compile_definitions(${target} PUBLIC $<$<CONFIG:Debug>:${CEF_COMPILER_DEFINES_DEBUG}>)
|
||||
target_compile_definitions(${target} PUBLIC $<$<CONFIG:Release>:${CEF_COMPILER_DEFINES_RELEASE}>)
|
||||
|
||||
# Include directories.
|
||||
target_include_directories(${target} PUBLIC ${CEF_INCLUDE_PATH})
|
||||
|
||||
# Linker flags.
|
||||
if(CEF_LINKER_FLAGS)
|
||||
string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS}")
|
||||
set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
|
||||
endif()
|
||||
if(CEF_LINKER_FLAGS_DEBUG)
|
||||
string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS_DEBUG}")
|
||||
set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
|
||||
endif()
|
||||
if(CEF_LINKER_FLAGS_RELEASE)
|
||||
string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS_RELEASE}")
|
||||
set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
|
||||
endif()
|
||||
|
||||
if(OS_MACOSX)
|
||||
# Set Xcode target properties.
|
||||
set_target_properties(${target} PROPERTIES
|
||||
XCODE_ATTRIBUTE_ALWAYS_SEARCH_USER_PATHS NO
|
||||
XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11
|
||||
XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME NO # -fno-objc-link-runtime
|
||||
XCODE_ATTRIBUTE_CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS YES # -Wobjc-missing-property-synthesis
|
||||
XCODE_ATTRIBUTE_COPY_PHASE_STRIP NO
|
||||
XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] YES # -Wl,-dead_strip
|
||||
XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99
|
||||
XCODE_ATTRIBUTE_GCC_CW_ASM_SYNTAX NO # No -fasm-blocks
|
||||
XCODE_ATTRIBUTE_GCC_DYNAMIC_NO_PIC NO
|
||||
XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS NO # -fno-exceptions
|
||||
XCODE_ATTRIBUTE_GCC_ENABLE_CPP_RTTI NO # -fno-rtti
|
||||
XCODE_ATTRIBUTE_GCC_ENABLE_PASCAL_STRINGS NO # No -mpascal-strings
|
||||
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES # -fvisibility-inlines-hidden
|
||||
XCODE_ATTRIBUTE_GCC_OBJC_CALL_CXX_CDTORS YES # -fobjc-call-cxx-cdtors
|
||||
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES # -fvisibility=hidden
|
||||
XCODE_ATTRIBUTE_GCC_THREADSAFE_STATICS NO # -fno-threadsafe-statics
|
||||
XCODE_ATTRIBUTE_GCC_TREAT_WARNINGS_AS_ERRORS YES # -Werror
|
||||
XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0"
|
||||
XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE YES # -Wnewline-eof
|
||||
XCODE_ATTRIBUTE_USE_HEADERMAP NO
|
||||
OSX_ARCHITECTURES_DEBUG "${CMAKE_OSX_ARCHITECTURES}"
|
||||
OSX_ARCHITECTURES_RELEASE "${CMAKE_OSX_ARCHITECTURES}"
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Set library-specific properties.
|
||||
macro(SET_LIBRARY_TARGET_PROPERTIES target)
|
||||
SET_COMMON_TARGET_PROPERTIES(${target})
|
||||
|
||||
# Shared library linker flags.
|
||||
if(CEF_SHARED_LINKER_FLAGS)
|
||||
string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS}")
|
||||
set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
|
||||
endif()
|
||||
if(CEF_SHARED_LINKER_FLAGS_DEBUG)
|
||||
string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
|
||||
endif()
|
||||
if(CEF_SHARED_LINKER_FLAGS_RELEASE)
|
||||
string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS_RELEASE}")
|
||||
set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Set executable-specific properties.
|
||||
macro(SET_EXECUTABLE_TARGET_PROPERTIES target)
|
||||
SET_COMMON_TARGET_PROPERTIES(${target})
|
||||
|
||||
# Executable linker flags.
|
||||
if(CEF_EXE_LINKER_FLAGS)
|
||||
string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS}")
|
||||
set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
|
||||
endif()
|
||||
if(CEF_EXE_LINKER_FLAGS_DEBUG)
|
||||
string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS_DEBUG}")
|
||||
set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
|
||||
endif()
|
||||
if(CEF_EXE_LINKER_FLAGS_RELEASE)
|
||||
string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS_RELEASE}")
|
||||
set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
|
||||
endif()
|
||||
endmacro()
|
@@ -1,470 +0,0 @@
|
||||
# Copyright (c) 2016 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.
|
||||
|
||||
# Must be loaded via FindCEF.cmake.
|
||||
if(NOT DEFINED _CEF_ROOT_EXPLICIT)
|
||||
message(FATAL_ERROR "Use find_package(CEF) to load this file.")
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Shared configuration.
|
||||
#
|
||||
|
||||
# Determine the platform.
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
||||
set(OS_MACOSX 1)
|
||||
set(OS_POSIX 1)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
set(OS_LINUX 1)
|
||||
set(OS_POSIX 1)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
|
||||
set(OS_WINDOWS 1)
|
||||
endif()
|
||||
|
||||
# Determine the project architecture.
|
||||
if(NOT DEFINED PROJECT_ARCH)
|
||||
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
set(PROJECT_ARCH "x86_64")
|
||||
else()
|
||||
set(PROJECT_ARCH "x86")
|
||||
endif()
|
||||
|
||||
if(OS_MACOSX)
|
||||
# PROJECT_ARCH should be specified on Mac OS X.
|
||||
message(WARNING "No PROJECT_ARCH value specified, using ${PROJECT_ARCH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Determine the build type.
|
||||
if(NOT CMAKE_BUILD_TYPE AND
|
||||
(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles"))
|
||||
# CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
|
||||
|
||||
# Path to the include directory.
|
||||
set(CEF_INCLUDE_PATH "${_CEF_ROOT}")
|
||||
|
||||
# Path to the libcef_dll_wrapper target.
|
||||
set(CEF_LIBCEF_DLL_WRAPPER_PATH "${_CEF_ROOT}/libcef_dll")
|
||||
|
||||
|
||||
# Shared compiler/linker flags.
|
||||
list(APPEND CEF_COMPILER_DEFINES
|
||||
# Allow C++ programs to use stdint.h macros specified in the C99 standard that aren't
|
||||
# in the C++ standard (e.g. UINT8_MAX, INT64_MIN, etc)
|
||||
__STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# Linux configuration.
|
||||
#
|
||||
|
||||
if(OS_LINUX)
|
||||
# Platform-specific compiler/linker flags.
|
||||
set(CEF_LIBTYPE SHARED)
|
||||
list(APPEND CEF_COMPILER_FLAGS
|
||||
-fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
|
||||
-fPIC # Generate position-independent code for shared libraries
|
||||
-fstack-protector # Protect some vulnerable functions from stack-smashing (security feature)
|
||||
-funwind-tables # Support stack unwinding for backtrace()
|
||||
-fvisibility=hidden # Give hidden visibility to declarations that are not explicitly marked as visible
|
||||
--param=ssp-buffer-size=4 # Set the minimum buffer size protected by SSP (security feature, related to stack-protector)
|
||||
-pipe # Use pipes rather than temporary files for communication between build stages
|
||||
-pthread # Use the pthread library
|
||||
-Wall # Enable all warnings
|
||||
-Werror # Treat warnings as errors
|
||||
-Wno-missing-field-initializers # Don't warn about missing field initializers
|
||||
-Wno-unused-parameter # Don't warn about unused parameters
|
||||
)
|
||||
list(APPEND CEF_C_COMPILER_FLAGS
|
||||
-std=c99 # Use the C99 language standard
|
||||
)
|
||||
list(APPEND CEF_CXX_COMPILER_FLAGS
|
||||
-fno-exceptions # Disable exceptions
|
||||
-fno-rtti # Disable real-time type information
|
||||
-fno-threadsafe-statics # Don't generate thread-safe statics
|
||||
-fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
|
||||
-std=gnu++11 # Use the C++11 language standard including GNU extensions
|
||||
-Wsign-compare # Warn about mixed signed/unsigned type comparisons
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||
-O0 # Disable optimizations
|
||||
-g # Generate debug information
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_RELEASE
|
||||
-O2 # Optimize for maximum speed
|
||||
-fdata-sections # Enable linker optimizations to improve locality of reference for data sections
|
||||
-ffunction-sections # Enable linker optimizations to improve locality of reference for function sections
|
||||
-fno-ident # Ignore the #ident directive
|
||||
-U_FORTIFY_SOURCE # Undefine _FORTIFY_SOURCE in case it was previously defined
|
||||
-D_FORTIFY_SOURCE=2 # Add memory and string function protection (security feature, related to stack-protector)
|
||||
)
|
||||
list(APPEND CEF_LINKER_FLAGS
|
||||
-fPIC # Generate position-independent code for shared libraries
|
||||
-pthread # Use the pthread library
|
||||
-Wl,--disable-new-dtags # Don't generate new-style dynamic tags in ELF
|
||||
-Wl,--fatal-warnings # Treat warnings as errors
|
||||
-Wl,-rpath,. # Set rpath so that libraries can be placed next to the executable
|
||||
-Wl,-z,noexecstack # Mark the stack as non-executable (security feature)
|
||||
-Wl,-z,now # Resolve symbols on program start instead of on first use (security feature)
|
||||
-Wl,-z,relro # Mark relocation sections as read-only (security feature)
|
||||
)
|
||||
list(APPEND CEF_LINKER_FLAGS_RELEASE
|
||||
-Wl,-O1 # Enable linker optimizations
|
||||
-Wl,--as-needed # Only link libraries that export symbols used by the binary
|
||||
-Wl,--gc-sections # Remove unused code resulting from -fdata-sections and -function-sections
|
||||
)
|
||||
list(APPEND CEF_COMPILER_DEFINES
|
||||
_FILE_OFFSET_BITS=64 # Allow the Large File Support (LFS) interface to replace the old interface
|
||||
)
|
||||
list(APPEND CEF_COMPILER_DEFINES_RELEASE
|
||||
NDEBUG # Not a debug build
|
||||
)
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
CHECK_C_COMPILER_FLAG(-Wno-unused-local-typedefs COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
|
||||
if(COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
|
||||
list(APPEND CEF_C_COMPILER_FLAGS
|
||||
-Wno-unused-local-typedefs # Don't warn about unused local typedefs
|
||||
)
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG(-Wno-literal-suffix COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
|
||||
if(COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
|
||||
list(APPEND CEF_CXX_COMPILER_FLAGS
|
||||
-Wno-literal-suffix # Don't warn about invalid suffixes on literals
|
||||
)
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG(-Wno-narrowing COMPILER_SUPPORTS_NO_NARROWING)
|
||||
if(COMPILER_SUPPORTS_NO_NARROWING)
|
||||
list(APPEND CEF_CXX_COMPILER_FLAGS
|
||||
-Wno-narrowing # Don't warn about type narrowing
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PROJECT_ARCH STREQUAL "x86_64")
|
||||
# 64-bit architecture.
|
||||
list(APPEND CEF_COMPILER_FLAGS
|
||||
-m64
|
||||
-march=x86-64
|
||||
)
|
||||
list(APPEND CEF_LINKER_FLAGS
|
||||
-m64
|
||||
)
|
||||
elseif(PROJECT_ARCH STREQUAL "x86")
|
||||
# 32-bit architecture.
|
||||
list(APPEND CEF_COMPILER_FLAGS
|
||||
-msse2
|
||||
-mfpmath=sse
|
||||
-mmmx
|
||||
-m32
|
||||
)
|
||||
list(APPEND CEF_LINKER_FLAGS
|
||||
-m32
|
||||
)
|
||||
endif()
|
||||
|
||||
# Standard libraries.
|
||||
set(CEF_STANDARD_LIBS
|
||||
X11
|
||||
)
|
||||
|
||||
# CEF directory paths.
|
||||
set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources")
|
||||
set(CEF_BINARY_DIR "${_CEF_ROOT}/${CMAKE_BUILD_TYPE}")
|
||||
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
|
||||
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
|
||||
|
||||
# CEF library paths.
|
||||
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.so")
|
||||
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.so")
|
||||
|
||||
# List of CEF binary files.
|
||||
set(CEF_BINARY_FILES
|
||||
chrome-sandbox
|
||||
libcef.so
|
||||
natives_blob.bin
|
||||
snapshot_blob.bin
|
||||
)
|
||||
|
||||
# List of CEF resource files.
|
||||
set(CEF_RESOURCE_FILES
|
||||
cef.pak
|
||||
cef_100_percent.pak
|
||||
cef_200_percent.pak
|
||||
cef_extensions.pak
|
||||
devtools_resources.pak
|
||||
icudtl.dat
|
||||
locales
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Mac OS X configuration.
|
||||
#
|
||||
|
||||
if(OS_MACOSX)
|
||||
# Platform-specific compiler/linker flags.
|
||||
# See also Xcode target properties in macros.cmake.
|
||||
set(CEF_LIBTYPE SHARED)
|
||||
list(APPEND CEF_COMPILER_FLAGS
|
||||
-fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
|
||||
-fstack-protector # Protect some vulnerable functions from stack-smashing (security feature)
|
||||
-funwind-tables # Support stack unwinding for backtrace()
|
||||
-fvisibility=hidden # Give hidden visibility to declarations that are not explicitly marked as visible
|
||||
-Wall # Enable all warnings
|
||||
-Werror # Treat warnings as errors
|
||||
-Wextra # Enable additional warnings
|
||||
-Wendif-labels # Warn whenever an #else or an #endif is followed by text
|
||||
-Wnewline-eof # Warn about no newline at end of file
|
||||
-Wno-missing-field-initializers # Don't warn about missing field initializers
|
||||
-Wno-unused-parameter # Don't warn about unused parameters
|
||||
)
|
||||
list(APPEND CEF_C_COMPILER_FLAGS
|
||||
-std=c99 # Use the C99 language standard
|
||||
)
|
||||
list(APPEND CEF_CXX_COMPILER_FLAGS
|
||||
-fno-exceptions # Disable exceptions
|
||||
-fno-rtti # Disable real-time type information
|
||||
-fno-threadsafe-statics # Don't generate thread-safe statics
|
||||
-fobjc-call-cxx-cdtors # Call the constructor/destructor of C++ instance variables in ObjC objects
|
||||
-fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
|
||||
-std=gnu++11 # Use the C++11 language standard including GNU extensions
|
||||
-Wno-narrowing # Don't warn about type narrowing
|
||||
-Wsign-compare # Warn about mixed signed/unsigned type comparisons
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||
-O0 # Disable optimizations
|
||||
-g # Generate debug information
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_RELEASE
|
||||
-O3 # Optimize for maximum speed plus a few extras
|
||||
)
|
||||
list(APPEND CEF_LINKER_FLAGS
|
||||
-Wl,-search_paths_first # Search for static or shared library versions in the same pass
|
||||
-Wl,-ObjC # Support creation of ObjC static libraries
|
||||
-Wl,-pie # Generate position-independent code suitable for executables only
|
||||
)
|
||||
list(APPEND CEF_LINKER_FLAGS_RELEASE
|
||||
-Wl,-dead_strip # Strip dead code
|
||||
)
|
||||
|
||||
# Standard libraries.
|
||||
set(CEF_STANDARD_LIBS
|
||||
-lpthread
|
||||
"-framework Cocoa"
|
||||
"-framework AppKit"
|
||||
)
|
||||
|
||||
# Find the newest available base SDK.
|
||||
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
foreach(OS_VERSION 10.11 10.10 10.9)
|
||||
set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
|
||||
if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
|
||||
set(CMAKE_OSX_SYSROOT ${SDK})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Target SDK.
|
||||
set(CEF_TARGET_SDK "10.9")
|
||||
list(APPEND CEF_COMPILER_FLAGS
|
||||
-mmacosx-version-min=${CEF_TARGET_SDK}
|
||||
)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET ${CEF_TARGET_SDK})
|
||||
|
||||
# Target architecture.
|
||||
if(PROJECT_ARCH STREQUAL "x86_64")
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
||||
else()
|
||||
set(CMAKE_OSX_ARCHITECTURES "i386")
|
||||
endif()
|
||||
|
||||
# CEF directory paths.
|
||||
set(CEF_BINARY_DIR "${_CEF_ROOT}/$<CONFIGURATION>")
|
||||
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
|
||||
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
|
||||
|
||||
# CEF library paths.
|
||||
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
|
||||
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Windows configuration.
|
||||
#
|
||||
|
||||
if(OS_WINDOWS)
|
||||
# Configure use of the sandbox.
|
||||
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
|
||||
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900)
|
||||
# The cef_sandbox.lib static library is currently built with VS2015. It will
|
||||
# not link successfully with other VS versions.
|
||||
set(USE_SANDBOX OFF)
|
||||
endif()
|
||||
|
||||
# Configure use of official build compiler settings.
|
||||
# When using an official build the "Debug" build is actually a Release build
|
||||
# with DCHECKs enabled. In order to link the sandbox the Debug build must
|
||||
# be configured with some Release-related compiler settings.
|
||||
option(USE_OFFICIAL_BUILD_SANDBOX "Enable or disable use of an official build sandbox." ON)
|
||||
if(NOT USE_SANDBOX)
|
||||
# Don't need official build settings when the sandbox is off.
|
||||
set(USE_OFFICIAL_BUILD_SANDBOX OFF)
|
||||
endif()
|
||||
|
||||
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
|
||||
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
|
||||
|
||||
# Platform-specific compiler/linker flags.
|
||||
set(CEF_LIBTYPE STATIC)
|
||||
list(APPEND CEF_COMPILER_FLAGS
|
||||
/MP # Multiprocess compilation
|
||||
/Gy # Enable function-level linking
|
||||
/GR- # Disable run-time type information
|
||||
/W4 # Warning level 4
|
||||
/WX # Treat warnings as errors
|
||||
/wd4100 # Ignore "unreferenced formal parameter" warning
|
||||
/wd4127 # Ignore "conditional expression is constant" warning
|
||||
/wd4244 # Ignore "conversion possible loss of data" warning
|
||||
/wd4481 # Ignore "nonstandard extension used: override" warning
|
||||
/wd4512 # Ignore "assignment operator could not be generated" warning
|
||||
/wd4701 # Ignore "potentially uninitialized local variable" warning
|
||||
/wd4702 # Ignore "unreachable code" warning
|
||||
/wd4996 # Ignore "function or variable may be unsafe" warning
|
||||
${CEF_DEBUG_INFO_FLAG}
|
||||
)
|
||||
if(USE_OFFICIAL_BUILD_SANDBOX)
|
||||
# CMake adds /RTC1, /D"_DEBUG" and a few other values by default for Debug
|
||||
# builds. We can't link the sandbox with those values so clear the CMake
|
||||
# defaults here.
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "")
|
||||
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||
/MT # Multithreaded release runtime
|
||||
)
|
||||
else()
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||
/MTd # Multithreaded debug runtime
|
||||
/RTC1 # Disable optimizations
|
||||
/Od # Enable basic run-time checks
|
||||
)
|
||||
endif()
|
||||
list(APPEND CEF_COMPILER_FLAGS_RELEASE
|
||||
/MT # Multithreaded release runtime
|
||||
/O2 # Optimize for maximum speed
|
||||
/Ob2 # Inline any suitable function
|
||||
/GF # Enable string pooling
|
||||
)
|
||||
list(APPEND CEF_LINKER_FLAGS_DEBUG
|
||||
/DEBUG # Generate debug information
|
||||
)
|
||||
list(APPEND CEF_EXE_LINKER_FLAGS
|
||||
/MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
|
||||
/LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM
|
||||
)
|
||||
list(APPEND CEF_COMPILER_DEFINES
|
||||
WIN32 _WIN32 _WINDOWS # Windows platform
|
||||
UNICODE _UNICODE # Unicode build
|
||||
WINVER=0x0601 _WIN32_WINNT=0x601 # Targeting Windows 7
|
||||
NOMINMAX # Use the standard's templated min/max
|
||||
WIN32_LEAN_AND_MEAN # Exclude less common API declarations
|
||||
_HAS_EXCEPTIONS=0 # Disable exceptions
|
||||
)
|
||||
if(USE_OFFICIAL_BUILD_SANDBOX)
|
||||
list(APPEND CEF_COMPILER_DEFINES_DEBUG
|
||||
NDEBUG _NDEBUG # Not a debug build
|
||||
DCHECK_ALWAYS_ON=1 # DCHECKs are enabled
|
||||
)
|
||||
endif()
|
||||
list(APPEND CEF_COMPILER_DEFINES_RELEASE
|
||||
NDEBUG _NDEBUG # Not a debug build
|
||||
)
|
||||
|
||||
# Standard libraries.
|
||||
set(CEF_STANDARD_LIBS
|
||||
comctl32.lib
|
||||
rpcrt4.lib
|
||||
shlwapi.lib
|
||||
ws2_32.lib
|
||||
)
|
||||
|
||||
# CEF directory paths.
|
||||
set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources")
|
||||
set(CEF_BINARY_DIR "${_CEF_ROOT}/$<CONFIGURATION>")
|
||||
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
|
||||
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
|
||||
|
||||
# CEF library paths.
|
||||
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.lib")
|
||||
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.lib")
|
||||
|
||||
# List of CEF binary files.
|
||||
set(CEF_BINARY_FILES
|
||||
chrome_elf.dll
|
||||
d3dcompiler_43.dll
|
||||
d3dcompiler_47.dll
|
||||
libcef.dll
|
||||
libEGL.dll
|
||||
libGLESv2.dll
|
||||
natives_blob.bin
|
||||
snapshot_blob.bin
|
||||
)
|
||||
|
||||
# List of CEF resource files.
|
||||
set(CEF_RESOURCE_FILES
|
||||
cef.pak
|
||||
cef_100_percent.pak
|
||||
cef_200_percent.pak
|
||||
cef_extensions.pak
|
||||
devtools_resources.pak
|
||||
icudtl.dat
|
||||
locales
|
||||
)
|
||||
|
||||
if(USE_SANDBOX)
|
||||
list(APPEND CEF_COMPILER_DEFINES
|
||||
PSAPI_VERSION=1 # Required by cef_sandbox.lib
|
||||
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
|
||||
)
|
||||
|
||||
# Libraries required by cef_sandbox.lib.
|
||||
set(CEF_SANDBOX_STANDARD_LIBS
|
||||
dbghelp.lib
|
||||
psapi.lib
|
||||
version.lib
|
||||
winmm.lib
|
||||
)
|
||||
|
||||
# CEF sandbox library paths.
|
||||
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
|
||||
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
|
||||
endif()
|
||||
|
||||
# Configure use of ATL.
|
||||
option(USE_ATL "Enable or disable use of ATL." ON)
|
||||
if(USE_ATL)
|
||||
# Determine if the Visual Studio install supports ATL.
|
||||
get_filename_component(VC_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
||||
get_filename_component(VC_DIR ${VC_BIN_DIR} DIRECTORY)
|
||||
if(NOT IS_DIRECTORY "${VC_DIR}/atlmfc")
|
||||
set(USE_ATL OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_ATL)
|
||||
list(APPEND CEF_COMPILER_DEFINES
|
||||
CEF_USE_ATL # Used by apps to test if ATL support is enabled
|
||||
)
|
||||
endif()
|
||||
endif()
|
@@ -1,126 +0,0 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// 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.
|
||||
|
||||
// This is a low level implementation of atomic semantics for reference
|
||||
// counting. Please use cef_ref_counted.h directly instead.
|
||||
//
|
||||
// The Chromium implementation includes annotations to avoid some false
|
||||
// positives when using data race detection tools. Annotations are not
|
||||
// currently supported by the CEF implementation.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_ATOMIC_REF_COUNT_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/atomic_ref_count.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_atomicops.h"
|
||||
|
||||
// Annotations are not currently supported.
|
||||
#define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */
|
||||
#define ANNOTATE_HAPPENS_AFTER(obj) /* empty */
|
||||
|
||||
namespace base {
|
||||
|
||||
typedef subtle::Atomic32 AtomicRefCount;
|
||||
|
||||
// Increment a reference count by "increment", which must exceed 0.
|
||||
inline void AtomicRefCountIncN(volatile AtomicRefCount *ptr,
|
||||
AtomicRefCount increment) {
|
||||
subtle::NoBarrier_AtomicIncrement(ptr, increment);
|
||||
}
|
||||
|
||||
// Decrement a reference count by "decrement", which must exceed 0,
|
||||
// and return whether the result is non-zero.
|
||||
// Insert barriers to ensure that state written before the reference count
|
||||
// became zero will be visible to a thread that has just made the count zero.
|
||||
inline bool AtomicRefCountDecN(volatile AtomicRefCount *ptr,
|
||||
AtomicRefCount decrement) {
|
||||
ANNOTATE_HAPPENS_BEFORE(ptr);
|
||||
bool res = (subtle::Barrier_AtomicIncrement(ptr, -decrement) != 0);
|
||||
if (!res) {
|
||||
ANNOTATE_HAPPENS_AFTER(ptr);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// Increment a reference count by 1.
|
||||
inline void AtomicRefCountInc(volatile AtomicRefCount *ptr) {
|
||||
base::AtomicRefCountIncN(ptr, 1);
|
||||
}
|
||||
|
||||
// Decrement a reference count by 1 and return whether the result is non-zero.
|
||||
// Insert barriers to ensure that state written before the reference count
|
||||
// became zero will be visible to a thread that has just made the count zero.
|
||||
inline bool AtomicRefCountDec(volatile AtomicRefCount *ptr) {
|
||||
return base::AtomicRefCountDecN(ptr, 1);
|
||||
}
|
||||
|
||||
// Return whether the reference count is one. If the reference count is used
|
||||
// in the conventional way, a refrerence count of 1 implies that the current
|
||||
// thread owns the reference and no other thread shares it. This call performs
|
||||
// the test for a reference count of one, and performs the memory barrier
|
||||
// needed for the owning thread to act on the object, knowing that it has
|
||||
// exclusive access to the object.
|
||||
inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) {
|
||||
bool res = (subtle::Acquire_Load(ptr) == 1);
|
||||
if (res) {
|
||||
ANNOTATE_HAPPENS_AFTER(ptr);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// Return whether the reference count is zero. With conventional object
|
||||
// referencing counting, the object will be destroyed, so the reference count
|
||||
// should never be zero. Hence this is generally used for a debug check.
|
||||
inline bool AtomicRefCountIsZero(volatile AtomicRefCount *ptr) {
|
||||
bool res = (subtle::Acquire_Load(ptr) == 0);
|
||||
if (res) {
|
||||
ANNOTATE_HAPPENS_AFTER(ptr);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
|
@@ -1,200 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// For atomic operations on reference counts, see cef_atomic_ref_count.h.
|
||||
|
||||
// The routines exported by this module are subtle. If you use them, even if
|
||||
// you get the code right, it will depend on careful reasoning about atomicity
|
||||
// and memory ordering; it will be less readable, and harder to maintain. If
|
||||
// you plan to use these routines, you should have a good reason, such as solid
|
||||
// evidence that performance would otherwise suffer, or there being no
|
||||
// alternative. You should assume only properties explicitly guaranteed by the
|
||||
// specifications in this file. You are almost certainly _not_ writing code
|
||||
// just for the x86; if you assume x86 semantics, x86 hardware bugs and
|
||||
// implementations on other archtectures will cause your code to break. If you
|
||||
// do not know what you are doing, avoid these routines, and use a Mutex.
|
||||
//
|
||||
// It is incorrect to make direct assignments to/from an atomic variable.
|
||||
// You should use one of the Load or Store routines. The NoBarrier
|
||||
// versions are provided when no barriers are needed:
|
||||
// NoBarrier_Store()
|
||||
// NoBarrier_Load()
|
||||
// Although there are currently no compiler enforcement, you are encouraged
|
||||
// to use these.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_ATOMICOPS_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/atomicops.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
|
||||
#if defined(OS_WIN) && defined(ARCH_CPU_64_BITS)
|
||||
// windows.h #defines this (only on x64). This causes problems because the
|
||||
// public API also uses MemoryBarrier at the public name for this fence. So, on
|
||||
// X64, undef it, and call its documented
|
||||
// (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx)
|
||||
// implementation directly.
|
||||
#undef MemoryBarrier
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
namespace subtle {
|
||||
|
||||
typedef int32_t Atomic32;
|
||||
#ifdef ARCH_CPU_64_BITS
|
||||
// We need to be able to go between Atomic64 and AtomicWord implicitly. This
|
||||
// means Atomic64 and AtomicWord should be the same type on 64-bit.
|
||||
#if defined(__ILP32__) || defined(OS_NACL)
|
||||
// NaCl's intptr_t is not actually 64-bits on 64-bit!
|
||||
// http://code.google.com/p/nativeclient/issues/detail?id=1162
|
||||
typedef int64_t Atomic64;
|
||||
#else
|
||||
typedef intptr_t Atomic64;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
|
||||
// Atomic64 routines below, depending on your architecture.
|
||||
typedef intptr_t AtomicWord;
|
||||
|
||||
// Atomically execute:
|
||||
// result = *ptr;
|
||||
// if (*ptr == old_value)
|
||||
// *ptr = new_value;
|
||||
// return result;
|
||||
//
|
||||
// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value".
|
||||
// Always return the old value of "*ptr"
|
||||
//
|
||||
// This routine implies no memory barriers.
|
||||
Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
|
||||
Atomic32 old_value,
|
||||
Atomic32 new_value);
|
||||
|
||||
// Atomically store new_value into *ptr, returning the previous value held in
|
||||
// *ptr. This routine implies no memory barriers.
|
||||
Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value);
|
||||
|
||||
// Atomically increment *ptr by "increment". Returns the new value of
|
||||
// *ptr with the increment applied. This routine implies no memory barriers.
|
||||
Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment);
|
||||
|
||||
Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
|
||||
Atomic32 increment);
|
||||
|
||||
// These following lower-level operations are typically useful only to people
|
||||
// implementing higher-level synchronization operations like spinlocks,
|
||||
// mutexes, and condition-variables. They combine CompareAndSwap(), a load, or
|
||||
// a store with appropriate memory-ordering instructions. "Acquire" operations
|
||||
// ensure that no later memory access can be reordered ahead of the operation.
|
||||
// "Release" operations ensure that no previous memory access can be reordered
|
||||
// after the operation. "Barrier" operations have both "Acquire" and "Release"
|
||||
// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory
|
||||
// access.
|
||||
Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
|
||||
Atomic32 old_value,
|
||||
Atomic32 new_value);
|
||||
Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
|
||||
Atomic32 old_value,
|
||||
Atomic32 new_value);
|
||||
|
||||
void MemoryBarrier();
|
||||
void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value);
|
||||
void Acquire_Store(volatile Atomic32* ptr, Atomic32 value);
|
||||
void Release_Store(volatile Atomic32* ptr, Atomic32 value);
|
||||
|
||||
Atomic32 NoBarrier_Load(volatile const Atomic32* ptr);
|
||||
Atomic32 Acquire_Load(volatile const Atomic32* ptr);
|
||||
Atomic32 Release_Load(volatile const Atomic32* ptr);
|
||||
|
||||
// 64-bit atomic operations (only available on 64-bit processors).
|
||||
#ifdef ARCH_CPU_64_BITS
|
||||
Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
|
||||
Atomic64 old_value,
|
||||
Atomic64 new_value);
|
||||
Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value);
|
||||
Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment);
|
||||
Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment);
|
||||
|
||||
Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
|
||||
Atomic64 old_value,
|
||||
Atomic64 new_value);
|
||||
Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
|
||||
Atomic64 old_value,
|
||||
Atomic64 new_value);
|
||||
void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value);
|
||||
void Acquire_Store(volatile Atomic64* ptr, Atomic64 value);
|
||||
void Release_Store(volatile Atomic64* ptr, Atomic64 value);
|
||||
Atomic64 NoBarrier_Load(volatile const Atomic64* ptr);
|
||||
Atomic64 Acquire_Load(volatile const Atomic64* ptr);
|
||||
Atomic64 Release_Load(volatile const Atomic64* ptr);
|
||||
#endif // ARCH_CPU_64_BITS
|
||||
|
||||
} // namespace subtle
|
||||
} // namespace base
|
||||
|
||||
// Include our platform specific implementation.
|
||||
#if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY)
|
||||
#include "include/base/internal/cef_atomicops_x86_msvc.h"
|
||||
#elif defined(OS_MACOSX)
|
||||
#include "include/base/internal/cef_atomicops_mac.h"
|
||||
#elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY)
|
||||
#include "include/base/internal/cef_atomicops_x86_gcc.h"
|
||||
#elif defined(COMPILER_GCC) && defined(__ARM_ARCH)
|
||||
#include "include/base/internal/cef_atomicops_arm_gcc.h"
|
||||
#else
|
||||
#error "Atomic operations are not supported on your platform"
|
||||
#endif
|
||||
|
||||
// On some platforms we need additional declarations to make
|
||||
// AtomicWord compatible with our other Atomic* types.
|
||||
#if defined(OS_MACOSX) || defined(OS_OPENBSD)
|
||||
#include "include/base/internal/cef_atomicops_atomicword_compat.h"
|
||||
#endif
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_
|
@@ -1,77 +0,0 @@
|
||||
// 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_BASICTYPES_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
|
||||
#pragma once
|
||||
|
||||
#include <limits.h> // For UINT_MAX
|
||||
#include <stddef.h> // For size_t
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
|
||||
// The NSPR system headers define 64-bit as |long| when possible, except on
|
||||
// Mac OS X. In order to not have typedef mismatches, we do the same on LP64.
|
||||
//
|
||||
// On Mac OS X, |long long| is used for 64-bit types for compatibility with
|
||||
// <inttypes.h> format macros even in the LP64 model.
|
||||
#if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
|
||||
typedef long int64; // NOLINT(runtime/int)
|
||||
typedef unsigned long uint64; // NOLINT(runtime/int)
|
||||
#else
|
||||
typedef long long int64; // NOLINT(runtime/int)
|
||||
typedef unsigned long long uint64; // NOLINT(runtime/int)
|
||||
#endif
|
||||
|
||||
// TODO: Remove these type guards. These are to avoid conflicts with
|
||||
// obsolete/protypes.h in the Gecko SDK.
|
||||
#ifndef _INT32
|
||||
#define _INT32
|
||||
typedef int int32;
|
||||
#endif
|
||||
|
||||
// TODO: Remove these type guards. These are to avoid conflicts with
|
||||
// obsolete/protypes.h in the Gecko SDK.
|
||||
#ifndef _UINT32
|
||||
#define _UINT32
|
||||
typedef unsigned int uint32;
|
||||
#endif
|
||||
|
||||
// UTF-16 character type.
|
||||
// This should be kept synchronized with base/strings/string16.h
|
||||
#ifndef char16
|
||||
#if defined(WCHAR_T_IS_UTF16)
|
||||
typedef wchar_t char16;
|
||||
#elif defined(WCHAR_T_IS_UTF32)
|
||||
typedef unsigned short char16;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
|
@@ -1,548 +0,0 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// 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_BIND_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_BIND_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_BIND_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/bind.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/internal/cef_bind_internal.h"
|
||||
#include "include/base/internal/cef_callback_internal.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Usage documentation
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// See base/cef_callback.h for documentation.
|
||||
//
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
// Implementation notes
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// If you're reading the implementation, before proceeding further, you should
|
||||
// read the top comment of base/bind_internal.h for a definition of common
|
||||
// terms and concepts.
|
||||
//
|
||||
// RETURN TYPES
|
||||
//
|
||||
// Though Bind()'s result is meant to be stored in a Callback<> type, it
|
||||
// cannot actually return the exact type without requiring a large amount
|
||||
// of extra template specializations. The problem is that in order to
|
||||
// discern the correct specialization of Callback<>, Bind would need to
|
||||
// unwrap the function signature to determine the signature's arity, and
|
||||
// whether or not it is a method.
|
||||
//
|
||||
// Each unique combination of (arity, function_type, num_prebound) where
|
||||
// function_type is one of {function, method, const_method} would require
|
||||
// one specialization. We eventually have to do a similar number of
|
||||
// specializations anyways in the implementation (see the Invoker<>,
|
||||
// classes). However, it is avoidable in Bind if we return the result
|
||||
// via an indirection like we do below.
|
||||
//
|
||||
// TODO(ajwong): We might be able to avoid this now, but need to test.
|
||||
//
|
||||
// It is possible to move most of the COMPILE_ASSERT asserts into BindState<>,
|
||||
// but it feels a little nicer to have the asserts here so people do not
|
||||
// need to crack open bind_internal.h. On the other hand, it makes Bind()
|
||||
// harder to read.
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename Functor>
|
||||
base::Callback<
|
||||
typename cef_internal::BindState<
|
||||
typename cef_internal::FunctorTraits<Functor>::RunnableType,
|
||||
typename cef_internal::FunctorTraits<Functor>::RunType,
|
||||
void()>
|
||||
::UnboundRunType>
|
||||
Bind(Functor functor) {
|
||||
// Typedefs for how to store and run the functor.
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
|
||||
|
||||
typedef cef_internal::BindState<RunnableType, RunType, void()> BindState;
|
||||
|
||||
|
||||
return Callback<typename BindState::UnboundRunType>(
|
||||
new BindState(cef_internal::MakeRunnable(functor)));
|
||||
}
|
||||
|
||||
template <typename Functor, typename P1>
|
||||
base::Callback<
|
||||
typename cef_internal::BindState<
|
||||
typename cef_internal::FunctorTraits<Functor>::RunnableType,
|
||||
typename cef_internal::FunctorTraits<Functor>::RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType)>
|
||||
::UnboundRunType>
|
||||
Bind(Functor functor, const P1& p1) {
|
||||
// Typedefs for how to store and run the functor.
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
|
||||
|
||||
// Use RunnableType::RunType instead of RunType above because our
|
||||
// checks should below for bound references need to know what the actual
|
||||
// functor is going to interpret the argument as.
|
||||
typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
|
||||
BoundFunctorTraits;
|
||||
|
||||
// Do not allow binding a non-const reference parameter. Non-const reference
|
||||
// parameters are disallowed by the Google style guide. Also, binding a
|
||||
// non-const reference parameter can make for subtle bugs because the
|
||||
// invoked function will receive a reference to the stored copy of the
|
||||
// argument and not the original.
|
||||
COMPILE_ASSERT(
|
||||
!(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ),
|
||||
do_not_bind_functions_with_nonconst_ref);
|
||||
|
||||
// For methods, we need to be careful for parameter 1. We do not require
|
||||
// a scoped_refptr because BindState<> itself takes care of AddRef() for
|
||||
// methods. We also disallow binding of an array as the method's target
|
||||
// object.
|
||||
COMPILE_ASSERT(
|
||||
cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
|
||||
p1_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!is_array<P1>::value,
|
||||
first_bound_argument_to_method_cannot_be_array);
|
||||
typedef cef_internal::BindState<RunnableType, RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType)> BindState;
|
||||
|
||||
|
||||
return Callback<typename BindState::UnboundRunType>(
|
||||
new BindState(cef_internal::MakeRunnable(functor), p1));
|
||||
}
|
||||
|
||||
template <typename Functor, typename P1, typename P2>
|
||||
base::Callback<
|
||||
typename cef_internal::BindState<
|
||||
typename cef_internal::FunctorTraits<Functor>::RunnableType,
|
||||
typename cef_internal::FunctorTraits<Functor>::RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType)>
|
||||
::UnboundRunType>
|
||||
Bind(Functor functor, const P1& p1, const P2& p2) {
|
||||
// Typedefs for how to store and run the functor.
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
|
||||
|
||||
// Use RunnableType::RunType instead of RunType above because our
|
||||
// checks should below for bound references need to know what the actual
|
||||
// functor is going to interpret the argument as.
|
||||
typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
|
||||
BoundFunctorTraits;
|
||||
|
||||
// Do not allow binding a non-const reference parameter. Non-const reference
|
||||
// parameters are disallowed by the Google style guide. Also, binding a
|
||||
// non-const reference parameter can make for subtle bugs because the
|
||||
// invoked function will receive a reference to the stored copy of the
|
||||
// argument and not the original.
|
||||
COMPILE_ASSERT(
|
||||
!(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ),
|
||||
do_not_bind_functions_with_nonconst_ref);
|
||||
|
||||
// For methods, we need to be careful for parameter 1. We do not require
|
||||
// a scoped_refptr because BindState<> itself takes care of AddRef() for
|
||||
// methods. We also disallow binding of an array as the method's target
|
||||
// object.
|
||||
COMPILE_ASSERT(
|
||||
cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
|
||||
p1_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!is_array<P1>::value,
|
||||
first_bound_argument_to_method_cannot_be_array);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
|
||||
p2_is_refcounted_type_and_needs_scoped_refptr);
|
||||
typedef cef_internal::BindState<RunnableType, RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType)> BindState;
|
||||
|
||||
|
||||
return Callback<typename BindState::UnboundRunType>(
|
||||
new BindState(cef_internal::MakeRunnable(functor), p1, p2));
|
||||
}
|
||||
|
||||
template <typename Functor, typename P1, typename P2, typename P3>
|
||||
base::Callback<
|
||||
typename cef_internal::BindState<
|
||||
typename cef_internal::FunctorTraits<Functor>::RunnableType,
|
||||
typename cef_internal::FunctorTraits<Functor>::RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P3>::StorageType)>
|
||||
::UnboundRunType>
|
||||
Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3) {
|
||||
// Typedefs for how to store and run the functor.
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
|
||||
|
||||
// Use RunnableType::RunType instead of RunType above because our
|
||||
// checks should below for bound references need to know what the actual
|
||||
// functor is going to interpret the argument as.
|
||||
typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
|
||||
BoundFunctorTraits;
|
||||
|
||||
// Do not allow binding a non-const reference parameter. Non-const reference
|
||||
// parameters are disallowed by the Google style guide. Also, binding a
|
||||
// non-const reference parameter can make for subtle bugs because the
|
||||
// invoked function will receive a reference to the stored copy of the
|
||||
// argument and not the original.
|
||||
COMPILE_ASSERT(
|
||||
!(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ),
|
||||
do_not_bind_functions_with_nonconst_ref);
|
||||
|
||||
// For methods, we need to be careful for parameter 1. We do not require
|
||||
// a scoped_refptr because BindState<> itself takes care of AddRef() for
|
||||
// methods. We also disallow binding of an array as the method's target
|
||||
// object.
|
||||
COMPILE_ASSERT(
|
||||
cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
|
||||
p1_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!is_array<P1>::value,
|
||||
first_bound_argument_to_method_cannot_be_array);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
|
||||
p2_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
|
||||
p3_is_refcounted_type_and_needs_scoped_refptr);
|
||||
typedef cef_internal::BindState<RunnableType, RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P3>::StorageType)> BindState;
|
||||
|
||||
|
||||
return Callback<typename BindState::UnboundRunType>(
|
||||
new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3));
|
||||
}
|
||||
|
||||
template <typename Functor, typename P1, typename P2, typename P3, typename P4>
|
||||
base::Callback<
|
||||
typename cef_internal::BindState<
|
||||
typename cef_internal::FunctorTraits<Functor>::RunnableType,
|
||||
typename cef_internal::FunctorTraits<Functor>::RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P3>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P4>::StorageType)>
|
||||
::UnboundRunType>
|
||||
Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4) {
|
||||
// Typedefs for how to store and run the functor.
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
|
||||
|
||||
// Use RunnableType::RunType instead of RunType above because our
|
||||
// checks should below for bound references need to know what the actual
|
||||
// functor is going to interpret the argument as.
|
||||
typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
|
||||
BoundFunctorTraits;
|
||||
|
||||
// Do not allow binding a non-const reference parameter. Non-const reference
|
||||
// parameters are disallowed by the Google style guide. Also, binding a
|
||||
// non-const reference parameter can make for subtle bugs because the
|
||||
// invoked function will receive a reference to the stored copy of the
|
||||
// argument and not the original.
|
||||
COMPILE_ASSERT(
|
||||
!(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ),
|
||||
do_not_bind_functions_with_nonconst_ref);
|
||||
|
||||
// For methods, we need to be careful for parameter 1. We do not require
|
||||
// a scoped_refptr because BindState<> itself takes care of AddRef() for
|
||||
// methods. We also disallow binding of an array as the method's target
|
||||
// object.
|
||||
COMPILE_ASSERT(
|
||||
cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
|
||||
p1_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!is_array<P1>::value,
|
||||
first_bound_argument_to_method_cannot_be_array);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
|
||||
p2_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
|
||||
p3_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
|
||||
p4_is_refcounted_type_and_needs_scoped_refptr);
|
||||
typedef cef_internal::BindState<RunnableType, RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P3>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P4>::StorageType)> BindState;
|
||||
|
||||
|
||||
return Callback<typename BindState::UnboundRunType>(
|
||||
new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3, p4));
|
||||
}
|
||||
|
||||
template <typename Functor, typename P1, typename P2, typename P3, typename P4,
|
||||
typename P5>
|
||||
base::Callback<
|
||||
typename cef_internal::BindState<
|
||||
typename cef_internal::FunctorTraits<Functor>::RunnableType,
|
||||
typename cef_internal::FunctorTraits<Functor>::RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P3>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P4>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P5>::StorageType)>
|
||||
::UnboundRunType>
|
||||
Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4,
|
||||
const P5& p5) {
|
||||
// Typedefs for how to store and run the functor.
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
|
||||
|
||||
// Use RunnableType::RunType instead of RunType above because our
|
||||
// checks should below for bound references need to know what the actual
|
||||
// functor is going to interpret the argument as.
|
||||
typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
|
||||
BoundFunctorTraits;
|
||||
|
||||
// Do not allow binding a non-const reference parameter. Non-const reference
|
||||
// parameters are disallowed by the Google style guide. Also, binding a
|
||||
// non-const reference parameter can make for subtle bugs because the
|
||||
// invoked function will receive a reference to the stored copy of the
|
||||
// argument and not the original.
|
||||
COMPILE_ASSERT(
|
||||
!(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A5Type>::value ),
|
||||
do_not_bind_functions_with_nonconst_ref);
|
||||
|
||||
// For methods, we need to be careful for parameter 1. We do not require
|
||||
// a scoped_refptr because BindState<> itself takes care of AddRef() for
|
||||
// methods. We also disallow binding of an array as the method's target
|
||||
// object.
|
||||
COMPILE_ASSERT(
|
||||
cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
|
||||
p1_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!is_array<P1>::value,
|
||||
first_bound_argument_to_method_cannot_be_array);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
|
||||
p2_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
|
||||
p3_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
|
||||
p4_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P5>::value,
|
||||
p5_is_refcounted_type_and_needs_scoped_refptr);
|
||||
typedef cef_internal::BindState<RunnableType, RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P3>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P4>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P5>::StorageType)> BindState;
|
||||
|
||||
|
||||
return Callback<typename BindState::UnboundRunType>(
|
||||
new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5));
|
||||
}
|
||||
|
||||
template <typename Functor, typename P1, typename P2, typename P3, typename P4,
|
||||
typename P5, typename P6>
|
||||
base::Callback<
|
||||
typename cef_internal::BindState<
|
||||
typename cef_internal::FunctorTraits<Functor>::RunnableType,
|
||||
typename cef_internal::FunctorTraits<Functor>::RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P3>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P4>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P5>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P6>::StorageType)>
|
||||
::UnboundRunType>
|
||||
Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4,
|
||||
const P5& p5, const P6& p6) {
|
||||
// Typedefs for how to store and run the functor.
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
|
||||
|
||||
// Use RunnableType::RunType instead of RunType above because our
|
||||
// checks should below for bound references need to know what the actual
|
||||
// functor is going to interpret the argument as.
|
||||
typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
|
||||
BoundFunctorTraits;
|
||||
|
||||
// Do not allow binding a non-const reference parameter. Non-const reference
|
||||
// parameters are disallowed by the Google style guide. Also, binding a
|
||||
// non-const reference parameter can make for subtle bugs because the
|
||||
// invoked function will receive a reference to the stored copy of the
|
||||
// argument and not the original.
|
||||
COMPILE_ASSERT(
|
||||
!(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A5Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A6Type>::value ),
|
||||
do_not_bind_functions_with_nonconst_ref);
|
||||
|
||||
// For methods, we need to be careful for parameter 1. We do not require
|
||||
// a scoped_refptr because BindState<> itself takes care of AddRef() for
|
||||
// methods. We also disallow binding of an array as the method's target
|
||||
// object.
|
||||
COMPILE_ASSERT(
|
||||
cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
|
||||
p1_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!is_array<P1>::value,
|
||||
first_bound_argument_to_method_cannot_be_array);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
|
||||
p2_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
|
||||
p3_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
|
||||
p4_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P5>::value,
|
||||
p5_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P6>::value,
|
||||
p6_is_refcounted_type_and_needs_scoped_refptr);
|
||||
typedef cef_internal::BindState<RunnableType, RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P3>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P4>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P5>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P6>::StorageType)> BindState;
|
||||
|
||||
|
||||
return Callback<typename BindState::UnboundRunType>(
|
||||
new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6));
|
||||
}
|
||||
|
||||
template <typename Functor, typename P1, typename P2, typename P3, typename P4,
|
||||
typename P5, typename P6, typename P7>
|
||||
base::Callback<
|
||||
typename cef_internal::BindState<
|
||||
typename cef_internal::FunctorTraits<Functor>::RunnableType,
|
||||
typename cef_internal::FunctorTraits<Functor>::RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P3>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P4>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P5>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P6>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P7>::StorageType)>
|
||||
::UnboundRunType>
|
||||
Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4,
|
||||
const P5& p5, const P6& p6, const P7& p7) {
|
||||
// Typedefs for how to store and run the functor.
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
|
||||
typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
|
||||
|
||||
// Use RunnableType::RunType instead of RunType above because our
|
||||
// checks should below for bound references need to know what the actual
|
||||
// functor is going to interpret the argument as.
|
||||
typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
|
||||
BoundFunctorTraits;
|
||||
|
||||
// Do not allow binding a non-const reference parameter. Non-const reference
|
||||
// parameters are disallowed by the Google style guide. Also, binding a
|
||||
// non-const reference parameter can make for subtle bugs because the
|
||||
// invoked function will receive a reference to the stored copy of the
|
||||
// argument and not the original.
|
||||
COMPILE_ASSERT(
|
||||
!(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A5Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A6Type>::value ||
|
||||
is_non_const_reference<typename BoundFunctorTraits::A7Type>::value ),
|
||||
do_not_bind_functions_with_nonconst_ref);
|
||||
|
||||
// For methods, we need to be careful for parameter 1. We do not require
|
||||
// a scoped_refptr because BindState<> itself takes care of AddRef() for
|
||||
// methods. We also disallow binding of an array as the method's target
|
||||
// object.
|
||||
COMPILE_ASSERT(
|
||||
cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
|
||||
p1_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
|
||||
!is_array<P1>::value,
|
||||
first_bound_argument_to_method_cannot_be_array);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
|
||||
p2_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
|
||||
p3_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
|
||||
p4_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P5>::value,
|
||||
p5_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P6>::value,
|
||||
p6_is_refcounted_type_and_needs_scoped_refptr);
|
||||
COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P7>::value,
|
||||
p7_is_refcounted_type_and_needs_scoped_refptr);
|
||||
typedef cef_internal::BindState<RunnableType, RunType,
|
||||
void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P2>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P3>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P4>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P5>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P6>::StorageType,
|
||||
typename cef_internal::CallbackParamTraits<P7>::StorageType)> BindState;
|
||||
|
||||
|
||||
return Callback<typename BindState::UnboundRunType>(
|
||||
new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6,
|
||||
p7));
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_BIND_H_
|
@@ -1,586 +0,0 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// 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.
|
||||
|
||||
// This defines a set of argument wrappers and related factory methods that
|
||||
// can be used specify the refcounting and reference semantics of arguments
|
||||
// that are bound by the Bind() function in base/bind.h.
|
||||
//
|
||||
// It also defines a set of simple functions and utilities that people want
|
||||
// when using Callback<> and Bind().
|
||||
//
|
||||
//
|
||||
// ARGUMENT BINDING WRAPPERS
|
||||
//
|
||||
// The wrapper functions are base::Unretained(), base::Owned(), base::Passed(),
|
||||
// base::ConstRef(), and base::IgnoreResult().
|
||||
//
|
||||
// Unretained() allows Bind() to bind a non-refcounted class, and to disable
|
||||
// refcounting on arguments that are refcounted objects.
|
||||
//
|
||||
// Owned() transfers ownership of an object to the Callback resulting from
|
||||
// bind; the object will be deleted when the Callback is deleted.
|
||||
//
|
||||
// Passed() is for transferring movable-but-not-copyable types (eg. scoped_ptr)
|
||||
// through a Callback. Logically, this signifies a destructive transfer of
|
||||
// the state of the argument into the target function. Invoking
|
||||
// Callback::Run() twice on a Callback that was created with a Passed()
|
||||
// argument will CHECK() because the first invocation would have already
|
||||
// transferred ownership to the target function.
|
||||
//
|
||||
// ConstRef() allows binding a constant reference to an argument rather
|
||||
// than a copy.
|
||||
//
|
||||
// IgnoreResult() is used to adapt a function or Callback with a return type to
|
||||
// one with a void return. This is most useful if you have a function with,
|
||||
// say, a pesky ignorable bool return that you want to use with PostTask or
|
||||
// something else that expect a Callback with a void return.
|
||||
//
|
||||
// EXAMPLE OF Unretained():
|
||||
//
|
||||
// class Foo {
|
||||
// public:
|
||||
// void func() { cout << "Foo:f" << endl; }
|
||||
// };
|
||||
//
|
||||
// // In some function somewhere.
|
||||
// Foo foo;
|
||||
// Closure foo_callback =
|
||||
// Bind(&Foo::func, Unretained(&foo));
|
||||
// foo_callback.Run(); // Prints "Foo:f".
|
||||
//
|
||||
// Without the Unretained() wrapper on |&foo|, the above call would fail
|
||||
// to compile because Foo does not support the AddRef() and Release() methods.
|
||||
//
|
||||
//
|
||||
// EXAMPLE OF Owned():
|
||||
//
|
||||
// void foo(int* arg) { cout << *arg << endl }
|
||||
//
|
||||
// int* pn = new int(1);
|
||||
// Closure foo_callback = Bind(&foo, Owned(pn));
|
||||
//
|
||||
// foo_callback.Run(); // Prints "1"
|
||||
// foo_callback.Run(); // Prints "1"
|
||||
// *n = 2;
|
||||
// foo_callback.Run(); // Prints "2"
|
||||
//
|
||||
// foo_callback.Reset(); // |pn| is deleted. Also will happen when
|
||||
// // |foo_callback| goes out of scope.
|
||||
//
|
||||
// Without Owned(), someone would have to know to delete |pn| when the last
|
||||
// reference to the Callback is deleted.
|
||||
//
|
||||
//
|
||||
// EXAMPLE OF ConstRef():
|
||||
//
|
||||
// void foo(int arg) { cout << arg << endl }
|
||||
//
|
||||
// int n = 1;
|
||||
// Closure no_ref = Bind(&foo, n);
|
||||
// Closure has_ref = Bind(&foo, ConstRef(n));
|
||||
//
|
||||
// no_ref.Run(); // Prints "1"
|
||||
// has_ref.Run(); // Prints "1"
|
||||
//
|
||||
// n = 2;
|
||||
// no_ref.Run(); // Prints "1"
|
||||
// has_ref.Run(); // Prints "2"
|
||||
//
|
||||
// Note that because ConstRef() takes a reference on |n|, |n| must outlive all
|
||||
// its bound callbacks.
|
||||
//
|
||||
//
|
||||
// EXAMPLE OF IgnoreResult():
|
||||
//
|
||||
// int DoSomething(int arg) { cout << arg << endl; }
|
||||
//
|
||||
// // Assign to a Callback with a void return type.
|
||||
// Callback<void(int)> cb = Bind(IgnoreResult(&DoSomething));
|
||||
// cb->Run(1); // Prints "1".
|
||||
//
|
||||
// // Prints "1" on |ml|.
|
||||
// ml->PostTask(FROM_HERE, Bind(IgnoreResult(&DoSomething), 1);
|
||||
//
|
||||
//
|
||||
// EXAMPLE OF Passed():
|
||||
//
|
||||
// void TakesOwnership(scoped_ptr<Foo> arg) { }
|
||||
// scoped_ptr<Foo> CreateFoo() { return scoped_ptr<Foo>(new Foo()); }
|
||||
//
|
||||
// scoped_ptr<Foo> f(new Foo());
|
||||
//
|
||||
// // |cb| is given ownership of Foo(). |f| is now NULL.
|
||||
// // You can use f.Pass() in place of &f, but it's more verbose.
|
||||
// Closure cb = Bind(&TakesOwnership, Passed(&f));
|
||||
//
|
||||
// // Run was never called so |cb| still owns Foo() and deletes
|
||||
// // it on Reset().
|
||||
// cb.Reset();
|
||||
//
|
||||
// // |cb| is given a new Foo created by CreateFoo().
|
||||
// cb = Bind(&TakesOwnership, Passed(CreateFoo()));
|
||||
//
|
||||
// // |arg| in TakesOwnership() is given ownership of Foo(). |cb|
|
||||
// // no longer owns Foo() and, if reset, would not delete Foo().
|
||||
// cb.Run(); // Foo() is now transferred to |arg| and deleted.
|
||||
// cb.Run(); // This CHECK()s since Foo() already been used once.
|
||||
//
|
||||
// Passed() is particularly useful with PostTask() when you are transferring
|
||||
// ownership of an argument into a task, but don't necessarily know if the
|
||||
// task will always be executed. This can happen if the task is cancellable
|
||||
// or if it is posted to a MessageLoopProxy.
|
||||
//
|
||||
//
|
||||
// SIMPLE FUNCTIONS AND UTILITIES.
|
||||
//
|
||||
// DoNothing() - Useful for creating a Closure that does nothing when called.
|
||||
// DeletePointer<T>() - Useful for creating a Closure that will delete a
|
||||
// pointer when invoked. Only use this when necessary.
|
||||
// In most cases MessageLoop::DeleteSoon() is a better
|
||||
// fit.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_BIND_HELPERS_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/bind_helpers.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_basictypes.h"
|
||||
#include "include/base/cef_callback.h"
|
||||
#include "include/base/cef_template_util.h"
|
||||
#include "include/base/cef_weak_ptr.h"
|
||||
|
||||
namespace base {
|
||||
namespace cef_internal {
|
||||
|
||||
// Use the Substitution Failure Is Not An Error (SFINAE) trick to inspect T
|
||||
// for the existence of AddRef() and Release() functions of the correct
|
||||
// signature.
|
||||
//
|
||||
// http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error
|
||||
// http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence
|
||||
// http://stackoverflow.com/questions/4358584/sfinae-approach-comparison
|
||||
// http://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-member-functions
|
||||
//
|
||||
// The last link in particular show the method used below.
|
||||
//
|
||||
// For SFINAE to work with inherited methods, we need to pull some extra tricks
|
||||
// with multiple inheritance. In the more standard formulation, the overloads
|
||||
// of Check would be:
|
||||
//
|
||||
// template <typename C>
|
||||
// Yes NotTheCheckWeWant(Helper<&C::TargetFunc>*);
|
||||
//
|
||||
// template <typename C>
|
||||
// No NotTheCheckWeWant(...);
|
||||
//
|
||||
// static const bool value = sizeof(NotTheCheckWeWant<T>(0)) == sizeof(Yes);
|
||||
//
|
||||
// The problem here is that template resolution will not match
|
||||
// C::TargetFunc if TargetFunc does not exist directly in C. That is, if
|
||||
// TargetFunc in inherited from an ancestor, &C::TargetFunc will not match,
|
||||
// |value| will be false. This formulation only checks for whether or
|
||||
// not TargetFunc exist directly in the class being introspected.
|
||||
//
|
||||
// To get around this, we play a dirty trick with multiple inheritance.
|
||||
// First, We create a class BaseMixin that declares each function that we
|
||||
// want to probe for. Then we create a class Base that inherits from both T
|
||||
// (the class we wish to probe) and BaseMixin. Note that the function
|
||||
// signature in BaseMixin does not need to match the signature of the function
|
||||
// we are probing for; thus it's easiest to just use void(void).
|
||||
//
|
||||
// Now, if TargetFunc exists somewhere in T, then &Base::TargetFunc has an
|
||||
// ambiguous resolution between BaseMixin and T. This lets us write the
|
||||
// following:
|
||||
//
|
||||
// template <typename C>
|
||||
// No GoodCheck(Helper<&C::TargetFunc>*);
|
||||
//
|
||||
// template <typename C>
|
||||
// Yes GoodCheck(...);
|
||||
//
|
||||
// static const bool value = sizeof(GoodCheck<Base>(0)) == sizeof(Yes);
|
||||
//
|
||||
// Notice here that the variadic version of GoodCheck() returns Yes here
|
||||
// instead of No like the previous one. Also notice that we calculate |value|
|
||||
// by specializing GoodCheck() on Base instead of T.
|
||||
//
|
||||
// We've reversed the roles of the variadic, and Helper overloads.
|
||||
// GoodCheck(Helper<&C::TargetFunc>*), when C = Base, fails to be a valid
|
||||
// substitution if T::TargetFunc exists. Thus GoodCheck<Base>(0) will resolve
|
||||
// to the variadic version if T has TargetFunc. If T::TargetFunc does not
|
||||
// exist, then &C::TargetFunc is not ambiguous, and the overload resolution
|
||||
// will prefer GoodCheck(Helper<&C::TargetFunc>*).
|
||||
//
|
||||
// This method of SFINAE will correctly probe for inherited names, but it cannot
|
||||
// typecheck those names. It's still a good enough sanity check though.
|
||||
//
|
||||
// Works on gcc-4.2, gcc-4.4, and Visual Studio 2008.
|
||||
//
|
||||
// TODO(ajwong): Move to ref_counted.h or template_util.h when we've vetted
|
||||
// this works well.
|
||||
//
|
||||
// TODO(ajwong): Make this check for Release() as well.
|
||||
// See http://crbug.com/82038.
|
||||
template <typename T>
|
||||
class SupportsAddRefAndRelease {
|
||||
typedef char Yes[1];
|
||||
typedef char No[2];
|
||||
|
||||
struct BaseMixin {
|
||||
void AddRef();
|
||||
};
|
||||
|
||||
// MSVC warns when you try to use Base if T has a private destructor, the
|
||||
// common pattern for refcounted types. It does this even though no attempt to
|
||||
// instantiate Base is made. We disable the warning for this definition.
|
||||
#if defined(OS_WIN)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4624)
|
||||
#endif
|
||||
struct Base : public T, public BaseMixin {
|
||||
};
|
||||
#if defined(OS_WIN)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template <void(BaseMixin::*)(void)> struct Helper {};
|
||||
|
||||
template <typename C>
|
||||
static No& Check(Helper<&C::AddRef>*);
|
||||
|
||||
template <typename >
|
||||
static Yes& Check(...);
|
||||
|
||||
public:
|
||||
static const bool value = sizeof(Check<Base>(0)) == sizeof(Yes);
|
||||
};
|
||||
|
||||
// Helpers to assert that arguments of a recounted type are bound with a
|
||||
// scoped_refptr.
|
||||
template <bool IsClasstype, typename T>
|
||||
struct UnsafeBindtoRefCountedArgHelper : false_type {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct UnsafeBindtoRefCountedArgHelper<true, T>
|
||||
: integral_constant<bool, SupportsAddRefAndRelease<T>::value> {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct UnsafeBindtoRefCountedArg : false_type {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct UnsafeBindtoRefCountedArg<T*>
|
||||
: UnsafeBindtoRefCountedArgHelper<is_class<T>::value, T> {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class HasIsMethodTag {
|
||||
typedef char Yes[1];
|
||||
typedef char No[2];
|
||||
|
||||
template <typename U>
|
||||
static Yes& Check(typename U::IsMethod*);
|
||||
|
||||
template <typename U>
|
||||
static No& Check(...);
|
||||
|
||||
public:
|
||||
static const bool value = sizeof(Check<T>(0)) == sizeof(Yes);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class UnretainedWrapper {
|
||||
public:
|
||||
explicit UnretainedWrapper(T* o) : ptr_(o) {}
|
||||
T* get() const { return ptr_; }
|
||||
private:
|
||||
T* ptr_;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class ConstRefWrapper {
|
||||
public:
|
||||
explicit ConstRefWrapper(const T& o) : ptr_(&o) {}
|
||||
const T& get() const { return *ptr_; }
|
||||
private:
|
||||
const T* ptr_;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct IgnoreResultHelper {
|
||||
explicit IgnoreResultHelper(T functor) : functor_(functor) {}
|
||||
|
||||
T functor_;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct IgnoreResultHelper<Callback<T> > {
|
||||
explicit IgnoreResultHelper(const Callback<T>& functor) : functor_(functor) {}
|
||||
|
||||
const Callback<T>& functor_;
|
||||
};
|
||||
|
||||
// An alternate implementation is to avoid the destructive copy, and instead
|
||||
// specialize ParamTraits<> for OwnedWrapper<> to change the StorageType to
|
||||
// a class that is essentially a scoped_ptr<>.
|
||||
//
|
||||
// The current implementation has the benefit though of leaving ParamTraits<>
|
||||
// fully in callback_internal.h as well as avoiding type conversions during
|
||||
// storage.
|
||||
template <typename T>
|
||||
class OwnedWrapper {
|
||||
public:
|
||||
explicit OwnedWrapper(T* o) : ptr_(o) {}
|
||||
~OwnedWrapper() { delete ptr_; }
|
||||
T* get() const { return ptr_; }
|
||||
OwnedWrapper(const OwnedWrapper& other) {
|
||||
ptr_ = other.ptr_;
|
||||
other.ptr_ = NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable T* ptr_;
|
||||
};
|
||||
|
||||
// PassedWrapper is a copyable adapter for a scoper that ignores const.
|
||||
//
|
||||
// It is needed to get around the fact that Bind() takes a const reference to
|
||||
// all its arguments. Because Bind() takes a const reference to avoid
|
||||
// unnecessary copies, it is incompatible with movable-but-not-copyable
|
||||
// types; doing a destructive "move" of the type into Bind() would violate
|
||||
// the const correctness.
|
||||
//
|
||||
// This conundrum cannot be solved without either C++11 rvalue references or
|
||||
// a O(2^n) blowup of Bind() templates to handle each combination of regular
|
||||
// types and movable-but-not-copyable types. Thus we introduce a wrapper type
|
||||
// that is copyable to transmit the correct type information down into
|
||||
// BindState<>. Ignoring const in this type makes sense because it is only
|
||||
// created when we are explicitly trying to do a destructive move.
|
||||
//
|
||||
// Two notes:
|
||||
// 1) PassedWrapper supports any type that has a "Pass()" function.
|
||||
// This is intentional. The whitelisting of which specific types we
|
||||
// support is maintained by CallbackParamTraits<>.
|
||||
// 2) is_valid_ is distinct from NULL because it is valid to bind a "NULL"
|
||||
// scoper to a Callback and allow the Callback to execute once.
|
||||
template <typename T>
|
||||
class PassedWrapper {
|
||||
public:
|
||||
explicit PassedWrapper(T scoper) : is_valid_(true), scoper_(scoper.Pass()) {}
|
||||
PassedWrapper(const PassedWrapper& other)
|
||||
: is_valid_(other.is_valid_), scoper_(other.scoper_.Pass()) {
|
||||
}
|
||||
T Pass() const {
|
||||
CHECK(is_valid_);
|
||||
is_valid_ = false;
|
||||
return scoper_.Pass();
|
||||
}
|
||||
|
||||
private:
|
||||
mutable bool is_valid_;
|
||||
mutable T scoper_;
|
||||
};
|
||||
|
||||
// Unwrap the stored parameters for the wrappers above.
|
||||
template <typename T>
|
||||
struct UnwrapTraits {
|
||||
typedef const T& ForwardType;
|
||||
static ForwardType Unwrap(const T& o) { return o; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct UnwrapTraits<UnretainedWrapper<T> > {
|
||||
typedef T* ForwardType;
|
||||
static ForwardType Unwrap(UnretainedWrapper<T> unretained) {
|
||||
return unretained.get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct UnwrapTraits<ConstRefWrapper<T> > {
|
||||
typedef const T& ForwardType;
|
||||
static ForwardType Unwrap(ConstRefWrapper<T> const_ref) {
|
||||
return const_ref.get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct UnwrapTraits<scoped_refptr<T> > {
|
||||
typedef T* ForwardType;
|
||||
static ForwardType Unwrap(const scoped_refptr<T>& o) { return o.get(); }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct UnwrapTraits<WeakPtr<T> > {
|
||||
typedef const WeakPtr<T>& ForwardType;
|
||||
static ForwardType Unwrap(const WeakPtr<T>& o) { return o; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct UnwrapTraits<OwnedWrapper<T> > {
|
||||
typedef T* ForwardType;
|
||||
static ForwardType Unwrap(const OwnedWrapper<T>& o) {
|
||||
return o.get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct UnwrapTraits<PassedWrapper<T> > {
|
||||
typedef T ForwardType;
|
||||
static T Unwrap(PassedWrapper<T>& o) {
|
||||
return o.Pass();
|
||||
}
|
||||
};
|
||||
|
||||
// Utility for handling different refcounting semantics in the Bind()
|
||||
// function.
|
||||
template <bool is_method, typename T>
|
||||
struct MaybeRefcount;
|
||||
|
||||
template <typename T>
|
||||
struct MaybeRefcount<false, T> {
|
||||
static void AddRef(const T&) {}
|
||||
static void Release(const T&) {}
|
||||
};
|
||||
|
||||
template <typename T, size_t n>
|
||||
struct MaybeRefcount<false, T[n]> {
|
||||
static void AddRef(const T*) {}
|
||||
static void Release(const T*) {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct MaybeRefcount<true, T> {
|
||||
static void AddRef(const T&) {}
|
||||
static void Release(const T&) {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct MaybeRefcount<true, T*> {
|
||||
static void AddRef(T* o) { o->AddRef(); }
|
||||
static void Release(T* o) { o->Release(); }
|
||||
};
|
||||
|
||||
// No need to additionally AddRef() and Release() since we are storing a
|
||||
// scoped_refptr<> inside the storage object already.
|
||||
template <typename T>
|
||||
struct MaybeRefcount<true, scoped_refptr<T> > {
|
||||
static void AddRef(const scoped_refptr<T>& o) {}
|
||||
static void Release(const scoped_refptr<T>& o) {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct MaybeRefcount<true, const T*> {
|
||||
static void AddRef(const T* o) { o->AddRef(); }
|
||||
static void Release(const T* o) { o->Release(); }
|
||||
};
|
||||
|
||||
// IsWeakMethod is a helper that determine if we are binding a WeakPtr<> to a
|
||||
// method. It is used internally by Bind() to select the correct
|
||||
// InvokeHelper that will no-op itself in the event the WeakPtr<> for
|
||||
// the target object is invalidated.
|
||||
//
|
||||
// P1 should be the type of the object that will be received of the method.
|
||||
template <bool IsMethod, typename P1>
|
||||
struct IsWeakMethod : public false_type {};
|
||||
|
||||
template <typename T>
|
||||
struct IsWeakMethod<true, WeakPtr<T> > : public true_type {};
|
||||
|
||||
template <typename T>
|
||||
struct IsWeakMethod<true, ConstRefWrapper<WeakPtr<T> > > : public true_type {};
|
||||
|
||||
} // namespace cef_internal
|
||||
|
||||
template <typename T>
|
||||
static inline cef_internal::UnretainedWrapper<T> Unretained(T* o) {
|
||||
return cef_internal::UnretainedWrapper<T>(o);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline cef_internal::ConstRefWrapper<T> ConstRef(const T& o) {
|
||||
return cef_internal::ConstRefWrapper<T>(o);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline cef_internal::OwnedWrapper<T> Owned(T* o) {
|
||||
return cef_internal::OwnedWrapper<T>(o);
|
||||
}
|
||||
|
||||
// We offer 2 syntaxes for calling Passed(). The first takes a temporary and
|
||||
// is best suited for use with the return value of a function. The second
|
||||
// takes a pointer to the scoper and is just syntactic sugar to avoid having
|
||||
// to write Passed(scoper.Pass()).
|
||||
template <typename T>
|
||||
static inline cef_internal::PassedWrapper<T> Passed(T scoper) {
|
||||
return cef_internal::PassedWrapper<T>(scoper.Pass());
|
||||
}
|
||||
template <typename T>
|
||||
static inline cef_internal::PassedWrapper<T> Passed(T* scoper) {
|
||||
return cef_internal::PassedWrapper<T>(scoper->Pass());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline cef_internal::IgnoreResultHelper<T> IgnoreResult(T data) {
|
||||
return cef_internal::IgnoreResultHelper<T>(data);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline cef_internal::IgnoreResultHelper<Callback<T> >
|
||||
IgnoreResult(const Callback<T>& data) {
|
||||
return cef_internal::IgnoreResultHelper<Callback<T> >(data);
|
||||
}
|
||||
|
||||
void DoNothing();
|
||||
|
||||
template<typename T>
|
||||
void DeletePointer(T* obj) {
|
||||
delete obj;
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_
|
@@ -1,201 +0,0 @@
|
||||
// Copyright (c) 2011 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_BASE_CEF_BUILD_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_BUILD_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/compiler_specific.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// 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)
|
||||
#ifndef OS_WIN
|
||||
#define OS_WIN 1
|
||||
#endif
|
||||
#elif defined(__APPLE__)
|
||||
#ifndef OS_MACOSX
|
||||
#define OS_MACOSX 1
|
||||
#endif
|
||||
#elif defined(__linux__)
|
||||
#ifndef OS_LINUX
|
||||
#define OS_LINUX 1
|
||||
#endif
|
||||
#else
|
||||
#error Please add support for your platform in cef_build.h
|
||||
#endif
|
||||
|
||||
// For access to standard POSIXish features, use OS_POSIX instead of a
|
||||
// more specific macro.
|
||||
#if defined(OS_MACOSX) || defined(OS_LINUX)
|
||||
#ifndef OS_POSIX
|
||||
#define OS_POSIX 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Compiler detection.
|
||||
#if defined(__GNUC__)
|
||||
#ifndef COMPILER_GCC
|
||||
#define COMPILER_GCC 1
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#ifndef COMPILER_MSVC
|
||||
#define COMPILER_MSVC 1
|
||||
#endif
|
||||
#else
|
||||
#error Please add support for your compiler in cef_build.h
|
||||
#endif
|
||||
|
||||
// Processor architecture detection. For more info on what's defined, see:
|
||||
// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
|
||||
// http://www.agner.org/optimize/calling_conventions.pdf
|
||||
// or with gcc, run: "echo | gcc -E -dM -"
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
#define ARCH_CPU_X86_FAMILY 1
|
||||
#define ARCH_CPU_X86_64 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(_M_IX86) || defined(__i386__)
|
||||
#define ARCH_CPU_X86_FAMILY 1
|
||||
#define ARCH_CPU_X86 1
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__ARMEL__)
|
||||
#define ARCH_CPU_ARM_FAMILY 1
|
||||
#define ARCH_CPU_ARMEL 1
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__aarch64__)
|
||||
#define ARCH_CPU_ARM_FAMILY 1
|
||||
#define ARCH_CPU_ARM64 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__pnacl__)
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__MIPSEL__)
|
||||
#define ARCH_CPU_MIPS_FAMILY 1
|
||||
#define ARCH_CPU_MIPSEL 1
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#else
|
||||
#error Please add support for your architecture in cef_build.h
|
||||
#endif
|
||||
|
||||
// Type detection for wchar_t.
|
||||
#if defined(OS_WIN)
|
||||
#define WCHAR_T_IS_UTF16
|
||||
#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
|
||||
defined(__WCHAR_MAX__) && \
|
||||
(__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
|
||||
#define WCHAR_T_IS_UTF32
|
||||
#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
|
||||
defined(__WCHAR_MAX__) && \
|
||||
(__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
|
||||
// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
|
||||
// compile in this mode (in particular, Chrome doesn't). This is intended for
|
||||
// other projects using base who manage their own dependencies and make sure
|
||||
// short wchar works for them.
|
||||
#define WCHAR_T_IS_UTF16
|
||||
#else
|
||||
#error Please add support for your compiler in cef_build.h
|
||||
#endif
|
||||
|
||||
// Annotate a function indicating the caller must examine the return value.
|
||||
// Use like:
|
||||
// int foo() WARN_UNUSED_RESULT;
|
||||
// To explicitly ignore a result, see |ignore_result()| in <base/macros.h>.
|
||||
#ifndef WARN_UNUSED_RESULT
|
||||
#if defined(COMPILER_GCC)
|
||||
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
#define WARN_UNUSED_RESULT
|
||||
#endif
|
||||
#endif // WARN_UNUSED_RESULT
|
||||
|
||||
// Annotate a typedef or function indicating it's ok if it's not used.
|
||||
// Use like:
|
||||
// typedef Foo Bar ALLOW_UNUSED_TYPE;
|
||||
#ifndef ALLOW_UNUSED_TYPE
|
||||
#if defined(COMPILER_GCC)
|
||||
#define ALLOW_UNUSED_TYPE __attribute__((unused))
|
||||
#else
|
||||
#define ALLOW_UNUSED_TYPE
|
||||
#endif
|
||||
#endif // ALLOW_UNUSED_TYPE
|
||||
|
||||
// Annotate a variable indicating it's ok if the variable is not used.
|
||||
// (Typically used to silence a compiler warning when the assignment
|
||||
// is important for some other reason.)
|
||||
// Use like:
|
||||
// int x = ...;
|
||||
// ALLOW_UNUSED_LOCAL(x);
|
||||
#ifndef ALLOW_UNUSED_LOCAL
|
||||
#define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
|
||||
#endif
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
// Annotate a virtual method indicating it must be overriding a virtual method
|
||||
// in the parent class.
|
||||
// Use like:
|
||||
// void foo() OVERRIDE;
|
||||
// NOTE: This define should only be used in classes exposed to the client since
|
||||
// C++11 support may not be enabled in client applications. CEF internal classes
|
||||
// should use the `override` keyword directly.
|
||||
#ifndef OVERRIDE
|
||||
#if defined(__clang__)
|
||||
#define OVERRIDE override
|
||||
#elif defined(COMPILER_MSVC) && _MSC_VER >= 1600
|
||||
// Visual Studio 2010 and later support override.
|
||||
#define OVERRIDE override
|
||||
#elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \
|
||||
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700
|
||||
// GCC 4.7 supports explicit virtual overrides when C++11 support is enabled.
|
||||
#define OVERRIDE override
|
||||
#else
|
||||
#define OVERRIDE
|
||||
#endif
|
||||
#endif // OVERRIDE
|
||||
|
||||
// Check for C++11 template alias support which was added in VS2013 and GCC4.7.
|
||||
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
|
||||
#if __cplusplus > 199711L || \
|
||||
(defined(_MSC_VER) && _MSC_VER >= 1800) || \
|
||||
(defined(__GNUC__) && \
|
||||
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ >= 40700))
|
||||
#define HAS_CPP11_TEMPLATE_ALIAS_SUPPORT
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_BUILD_H_
|
@@ -1,807 +0,0 @@
|
||||
// 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_CALLBACK_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_CALLBACK_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_CALLBACK_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/callback.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/internal/cef_callback_internal.h"
|
||||
#include "include/base/cef_callback_forward.h"
|
||||
#include "include/base/cef_template_util.h"
|
||||
|
||||
// NOTE: Header files that do not require the full definition of Callback or
|
||||
// Closure should #include "base/cef_callback_forward.h" instead of this file.
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Introduction
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// The templated Callback class is a generalized function object. Together
|
||||
// with the Bind() function in bind.h, they provide a type-safe method for
|
||||
// performing partial application of functions.
|
||||
//
|
||||
// Partial application (or "currying") is the process of binding a subset of
|
||||
// a function's arguments to produce another function that takes fewer
|
||||
// arguments. This can be used to pass around a unit of delayed execution,
|
||||
// much like lexical closures are used in other languages. For example, it
|
||||
// is used in Chromium code to schedule tasks on different MessageLoops.
|
||||
//
|
||||
// A callback with no unbound input parameters (base::Callback<void(void)>)
|
||||
// is called a base::Closure. Note that this is NOT the same as what other
|
||||
// languages refer to as a closure -- it does not retain a reference to its
|
||||
// enclosing environment.
|
||||
//
|
||||
// MEMORY MANAGEMENT AND PASSING
|
||||
//
|
||||
// The Callback objects themselves should be passed by const-reference, and
|
||||
// stored by copy. They internally store their state via a refcounted class
|
||||
// and thus do not need to be deleted.
|
||||
//
|
||||
// The reason to pass via a const-reference is to avoid unnecessary
|
||||
// AddRef/Release pairs to the internal state.
|
||||
//
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
// Quick reference for basic stuff
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// BINDING A BARE FUNCTION
|
||||
//
|
||||
// int Return5() { return 5; }
|
||||
// base::Callback<int(void)> func_cb = base::Bind(&Return5);
|
||||
// LOG(INFO) << func_cb.Run(); // Prints 5.
|
||||
//
|
||||
// BINDING A CLASS METHOD
|
||||
//
|
||||
// The first argument to bind is the member function to call, the second is
|
||||
// the object on which to call it.
|
||||
//
|
||||
// class Ref : public base::RefCountedThreadSafe<Ref> {
|
||||
// public:
|
||||
// int Foo() { return 3; }
|
||||
// void PrintBye() { LOG(INFO) << "bye."; }
|
||||
// };
|
||||
// scoped_refptr<Ref> ref = new Ref();
|
||||
// base::Callback<void(void)> ref_cb = base::Bind(&Ref::Foo, ref);
|
||||
// LOG(INFO) << ref_cb.Run(); // Prints out 3.
|
||||
//
|
||||
// By default the object must support RefCounted or you will get a compiler
|
||||
// error. If you're passing between threads, be sure it's
|
||||
// RefCountedThreadSafe! See "Advanced binding of member functions" below if
|
||||
// you don't want to use reference counting.
|
||||
//
|
||||
// RUNNING A CALLBACK
|
||||
//
|
||||
// Callbacks can be run with their "Run" method, which has the same
|
||||
// signature as the template argument to the callback.
|
||||
//
|
||||
// void DoSomething(const base::Callback<void(int, std::string)>& callback) {
|
||||
// callback.Run(5, "hello");
|
||||
// }
|
||||
//
|
||||
// Callbacks can be run more than once (they don't get deleted or marked when
|
||||
// run). However, this precludes using base::Passed (see below).
|
||||
//
|
||||
// void DoSomething(const base::Callback<double(double)>& callback) {
|
||||
// double myresult = callback.Run(3.14159);
|
||||
// myresult += callback.Run(2.71828);
|
||||
// }
|
||||
//
|
||||
// PASSING UNBOUND INPUT PARAMETERS
|
||||
//
|
||||
// Unbound parameters are specified at the time a callback is Run(). They are
|
||||
// specified in the Callback template type:
|
||||
//
|
||||
// void MyFunc(int i, const std::string& str) {}
|
||||
// base::Callback<void(int, const std::string&)> cb = base::Bind(&MyFunc);
|
||||
// cb.Run(23, "hello, world");
|
||||
//
|
||||
// PASSING BOUND INPUT PARAMETERS
|
||||
//
|
||||
// Bound parameters are specified when you create thee callback as arguments
|
||||
// to Bind(). They will be passed to the function and the Run()ner of the
|
||||
// callback doesn't see those values or even know that the function it's
|
||||
// calling.
|
||||
//
|
||||
// void MyFunc(int i, const std::string& str) {}
|
||||
// base::Callback<void(void)> cb = base::Bind(&MyFunc, 23, "hello world");
|
||||
// cb.Run();
|
||||
//
|
||||
// A callback with no unbound input parameters (base::Callback<void(void)>)
|
||||
// is called a base::Closure. So we could have also written:
|
||||
//
|
||||
// base::Closure cb = base::Bind(&MyFunc, 23, "hello world");
|
||||
//
|
||||
// When calling member functions, bound parameters just go after the object
|
||||
// pointer.
|
||||
//
|
||||
// base::Closure cb = base::Bind(&MyClass::MyFunc, this, 23, "hello world");
|
||||
//
|
||||
// PARTIAL BINDING OF PARAMETERS
|
||||
//
|
||||
// You can specify some parameters when you create the callback, and specify
|
||||
// the rest when you execute the callback.
|
||||
//
|
||||
// void MyFunc(int i, const std::string& str) {}
|
||||
// base::Callback<void(const std::string&)> cb = base::Bind(&MyFunc, 23);
|
||||
// cb.Run("hello world");
|
||||
//
|
||||
// When calling a function bound parameters are first, followed by unbound
|
||||
// parameters.
|
||||
//
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
// Quick reference for advanced binding
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// BINDING A CLASS METHOD WITH WEAK POINTERS
|
||||
//
|
||||
// base::Bind(&MyClass::Foo, GetWeakPtr());
|
||||
//
|
||||
// The callback will not be run if the object has already been destroyed.
|
||||
// DANGER: weak pointers are not threadsafe, so don't use this
|
||||
// when passing between threads!
|
||||
//
|
||||
// BINDING A CLASS METHOD WITH MANUAL LIFETIME MANAGEMENT
|
||||
//
|
||||
// base::Bind(&MyClass::Foo, base::Unretained(this));
|
||||
//
|
||||
// This disables all lifetime management on the object. You're responsible
|
||||
// for making sure the object is alive at the time of the call. You break it,
|
||||
// you own it!
|
||||
//
|
||||
// BINDING A CLASS METHOD AND HAVING THE CALLBACK OWN THE CLASS
|
||||
//
|
||||
// MyClass* myclass = new MyClass;
|
||||
// base::Bind(&MyClass::Foo, base::Owned(myclass));
|
||||
//
|
||||
// The object will be deleted when the callback is destroyed, even if it's
|
||||
// not run (like if you post a task during shutdown). Potentially useful for
|
||||
// "fire and forget" cases.
|
||||
//
|
||||
// IGNORING RETURN VALUES
|
||||
//
|
||||
// Sometimes you want to call a function that returns a value in a callback
|
||||
// that doesn't expect a return value.
|
||||
//
|
||||
// int DoSomething(int arg) { cout << arg << endl; }
|
||||
// base::Callback<void<int>) cb =
|
||||
// base::Bind(base::IgnoreResult(&DoSomething));
|
||||
//
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
// Quick reference for binding parameters to Bind()
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// Bound parameters are specified as arguments to Bind() and are passed to the
|
||||
// function. A callback with no parameters or no unbound parameters is called a
|
||||
// Closure (base::Callback<void(void)> and base::Closure are the same thing).
|
||||
//
|
||||
// PASSING PARAMETERS OWNED BY THE CALLBACK
|
||||
//
|
||||
// void Foo(int* arg) { cout << *arg << endl; }
|
||||
// int* pn = new int(1);
|
||||
// base::Closure foo_callback = base::Bind(&foo, base::Owned(pn));
|
||||
//
|
||||
// The parameter will be deleted when the callback is destroyed, even if it's
|
||||
// not run (like if you post a task during shutdown).
|
||||
//
|
||||
// PASSING PARAMETERS AS A scoped_ptr
|
||||
//
|
||||
// void TakesOwnership(scoped_ptr<Foo> arg) {}
|
||||
// scoped_ptr<Foo> f(new Foo);
|
||||
// // f becomes null during the following call.
|
||||
// base::Closure cb = base::Bind(&TakesOwnership, base::Passed(&f));
|
||||
//
|
||||
// Ownership of the parameter will be with the callback until the it is run,
|
||||
// when ownership is passed to the callback function. This means the callback
|
||||
// can only be run once. If the callback is never run, it will delete the
|
||||
// object when it's destroyed.
|
||||
//
|
||||
// PASSING PARAMETERS AS A scoped_refptr
|
||||
//
|
||||
// void TakesOneRef(scoped_refptr<Foo> arg) {}
|
||||
// scoped_refptr<Foo> f(new Foo)
|
||||
// base::Closure cb = base::Bind(&TakesOneRef, f);
|
||||
//
|
||||
// This should "just work." The closure will take a reference as long as it
|
||||
// is alive, and another reference will be taken for the called function.
|
||||
//
|
||||
// PASSING PARAMETERS BY REFERENCE
|
||||
//
|
||||
// Const references are *copied* unless ConstRef is used. Example:
|
||||
//
|
||||
// void foo(const int& arg) { printf("%d %p\n", arg, &arg); }
|
||||
// int n = 1;
|
||||
// base::Closure has_copy = base::Bind(&foo, n);
|
||||
// base::Closure has_ref = base::Bind(&foo, base::ConstRef(n));
|
||||
// n = 2;
|
||||
// foo(n); // Prints "2 0xaaaaaaaaaaaa"
|
||||
// has_copy.Run(); // Prints "1 0xbbbbbbbbbbbb"
|
||||
// has_ref.Run(); // Prints "2 0xaaaaaaaaaaaa"
|
||||
//
|
||||
// Normally parameters are copied in the closure. DANGER: ConstRef stores a
|
||||
// const reference instead, referencing the original parameter. This means
|
||||
// that you must ensure the object outlives the callback!
|
||||
//
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
// Implementation notes
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// WHERE IS THIS DESIGN FROM:
|
||||
//
|
||||
// The design Callback and Bind is heavily influenced by C++'s
|
||||
// tr1::function/tr1::bind, and by the "Google Callback" system used inside
|
||||
// Google.
|
||||
//
|
||||
//
|
||||
// HOW THE IMPLEMENTATION WORKS:
|
||||
//
|
||||
// There are three main components to the system:
|
||||
// 1) The Callback classes.
|
||||
// 2) The Bind() functions.
|
||||
// 3) The arguments wrappers (e.g., Unretained() and ConstRef()).
|
||||
//
|
||||
// The Callback classes represent a generic function pointer. Internally,
|
||||
// it stores a refcounted piece of state that represents the target function
|
||||
// and all its bound parameters. Each Callback specialization has a templated
|
||||
// constructor that takes an BindState<>*. In the context of the constructor,
|
||||
// the static type of this BindState<> pointer uniquely identifies the
|
||||
// function it is representing, all its bound parameters, and a Run() method
|
||||
// that is capable of invoking the target.
|
||||
//
|
||||
// Callback's constructor takes the BindState<>* that has the full static type
|
||||
// and erases the target function type as well as the types of the bound
|
||||
// parameters. It does this by storing a pointer to the specific Run()
|
||||
// function, and upcasting the state of BindState<>* to a
|
||||
// BindStateBase*. This is safe as long as this BindStateBase pointer
|
||||
// is only used with the stored Run() pointer.
|
||||
//
|
||||
// To BindState<> objects are created inside the Bind() functions.
|
||||
// These functions, along with a set of internal templates, are responsible for
|
||||
//
|
||||
// - Unwrapping the function signature into return type, and parameters
|
||||
// - Determining the number of parameters that are bound
|
||||
// - Creating the BindState storing the bound parameters
|
||||
// - Performing compile-time asserts to avoid error-prone behavior
|
||||
// - Returning an Callback<> with an arity matching the number of unbound
|
||||
// parameters and that knows the correct refcounting semantics for the
|
||||
// target object if we are binding a method.
|
||||
//
|
||||
// The Bind functions do the above using type-inference, and template
|
||||
// specializations.
|
||||
//
|
||||
// By default Bind() will store copies of all bound parameters, and attempt
|
||||
// to refcount a target object if the function being bound is a class method.
|
||||
// These copies are created even if the function takes parameters as const
|
||||
// references. (Binding to non-const references is forbidden, see bind.h.)
|
||||
//
|
||||
// To change this behavior, we introduce a set of argument wrappers
|
||||
// (e.g., Unretained(), and ConstRef()). These are simple container templates
|
||||
// that are passed by value, and wrap a pointer to argument. See the
|
||||
// file-level comment in base/bind_helpers.h for more info.
|
||||
//
|
||||
// These types are passed to the Unwrap() functions, and the MaybeRefcount()
|
||||
// functions respectively to modify the behavior of Bind(). The Unwrap()
|
||||
// and MaybeRefcount() functions change behavior by doing partial
|
||||
// specialization based on whether or not a parameter is a wrapper type.
|
||||
//
|
||||
// ConstRef() is similar to tr1::cref. Unretained() is specific to Chromium.
|
||||
//
|
||||
//
|
||||
// WHY NOT TR1 FUNCTION/BIND?
|
||||
//
|
||||
// Direct use of tr1::function and tr1::bind was considered, but ultimately
|
||||
// rejected because of the number of copy constructors invocations involved
|
||||
// in the binding of arguments during construction, and the forwarding of
|
||||
// arguments during invocation. These copies will no longer be an issue in
|
||||
// C++0x because C++0x will support rvalue reference allowing for the compiler
|
||||
// to avoid these copies. However, waiting for C++0x is not an option.
|
||||
//
|
||||
// Measured with valgrind on gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5), the
|
||||
// tr1::bind call itself will invoke a non-trivial copy constructor three times
|
||||
// for each bound parameter. Also, each when passing a tr1::function, each
|
||||
// bound argument will be copied again.
|
||||
//
|
||||
// In addition to the copies taken at binding and invocation, copying a
|
||||
// tr1::function causes a copy to be made of all the bound parameters and
|
||||
// state.
|
||||
//
|
||||
// Furthermore, in Chromium, it is desirable for the Callback to take a
|
||||
// reference on a target object when representing a class method call. This
|
||||
// is not supported by tr1.
|
||||
//
|
||||
// Lastly, tr1::function and tr1::bind has a more general and flexible API.
|
||||
// This includes things like argument reordering by use of
|
||||
// tr1::bind::placeholder, support for non-const reference parameters, and some
|
||||
// limited amount of subtyping of the tr1::function object (e.g.,
|
||||
// tr1::function<int(int)> is convertible to tr1::function<void(int)>).
|
||||
//
|
||||
// These are not features that are required in Chromium. Some of them, such as
|
||||
// allowing for reference parameters, and subtyping of functions, may actually
|
||||
// become a source of errors. Removing support for these features actually
|
||||
// allows for a simpler implementation, and a terser Currying API.
|
||||
//
|
||||
//
|
||||
// WHY NOT GOOGLE CALLBACKS?
|
||||
//
|
||||
// The Google callback system also does not support refcounting. Furthermore,
|
||||
// its implementation has a number of strange edge cases with respect to type
|
||||
// conversion of its arguments. In particular, the argument's constness must
|
||||
// at times match exactly the function signature, or the type-inference might
|
||||
// break. Given the above, writing a custom solution was easier.
|
||||
//
|
||||
//
|
||||
// MISSING FUNCTIONALITY
|
||||
// - Invoking the return of Bind. Bind(&foo).Run() does not work;
|
||||
// - Binding arrays to functions that take a non-const pointer.
|
||||
// Example:
|
||||
// void Foo(const char* ptr);
|
||||
// void Bar(char* ptr);
|
||||
// Bind(&Foo, "test");
|
||||
// Bind(&Bar, "test"); // This fails because ptr is not const.
|
||||
|
||||
namespace base {
|
||||
|
||||
// First, we forward declare the Callback class template. This informs the
|
||||
// compiler that the template only has 1 type parameter which is the function
|
||||
// signature that the Callback is representing.
|
||||
//
|
||||
// After this, create template specializations for 0-7 parameters. Note that
|
||||
// even though the template typelist grows, the specialization still
|
||||
// only has one type: the function signature.
|
||||
//
|
||||
// If you are thinking of forward declaring Callback in your own header file,
|
||||
// please include "base/callback_forward.h" instead.
|
||||
template <typename Sig>
|
||||
class Callback;
|
||||
|
||||
namespace cef_internal {
|
||||
template <typename Runnable, typename RunType, typename BoundArgsType>
|
||||
struct BindState;
|
||||
} // namespace cef_internal
|
||||
|
||||
template <typename R>
|
||||
class Callback<R(void)> : public cef_internal::CallbackBase {
|
||||
public:
|
||||
typedef R(RunType)();
|
||||
|
||||
Callback() : CallbackBase(NULL) { }
|
||||
|
||||
// Note that this constructor CANNOT be explicit, and that Bind() CANNOT
|
||||
// return the exact Callback<> type. See base/bind.h for details.
|
||||
template <typename Runnable, typename BindRunType, typename BoundArgsType>
|
||||
Callback(cef_internal::BindState<Runnable, BindRunType,
|
||||
BoundArgsType>* bind_state)
|
||||
: CallbackBase(bind_state) {
|
||||
|
||||
// Force the assignment to a local variable of PolymorphicInvoke
|
||||
// so the compiler will typecheck that the passed in Run() method has
|
||||
// the correct type.
|
||||
PolymorphicInvoke invoke_func =
|
||||
&cef_internal::BindState<Runnable, BindRunType, BoundArgsType>
|
||||
::InvokerType::Run;
|
||||
polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
|
||||
}
|
||||
|
||||
bool Equals(const Callback& other) const {
|
||||
return CallbackBase::Equals(other);
|
||||
}
|
||||
|
||||
R Run() const {
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
|
||||
|
||||
return f(bind_state_.get());
|
||||
}
|
||||
|
||||
private:
|
||||
typedef R(*PolymorphicInvoke)(
|
||||
cef_internal::BindStateBase*);
|
||||
|
||||
};
|
||||
|
||||
template <typename R, typename A1>
|
||||
class Callback<R(A1)> : public cef_internal::CallbackBase {
|
||||
public:
|
||||
typedef R(RunType)(A1);
|
||||
|
||||
Callback() : CallbackBase(NULL) { }
|
||||
|
||||
// Note that this constructor CANNOT be explicit, and that Bind() CANNOT
|
||||
// return the exact Callback<> type. See base/bind.h for details.
|
||||
template <typename Runnable, typename BindRunType, typename BoundArgsType>
|
||||
Callback(cef_internal::BindState<Runnable, BindRunType,
|
||||
BoundArgsType>* bind_state)
|
||||
: CallbackBase(bind_state) {
|
||||
|
||||
// Force the assignment to a local variable of PolymorphicInvoke
|
||||
// so the compiler will typecheck that the passed in Run() method has
|
||||
// the correct type.
|
||||
PolymorphicInvoke invoke_func =
|
||||
&cef_internal::BindState<Runnable, BindRunType, BoundArgsType>
|
||||
::InvokerType::Run;
|
||||
polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
|
||||
}
|
||||
|
||||
bool Equals(const Callback& other) const {
|
||||
return CallbackBase::Equals(other);
|
||||
}
|
||||
|
||||
R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1) const {
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
|
||||
|
||||
return f(bind_state_.get(), cef_internal::CallbackForward(a1));
|
||||
}
|
||||
|
||||
private:
|
||||
typedef R(*PolymorphicInvoke)(
|
||||
cef_internal::BindStateBase*,
|
||||
typename cef_internal::CallbackParamTraits<A1>::ForwardType);
|
||||
|
||||
};
|
||||
|
||||
template <typename R, typename A1, typename A2>
|
||||
class Callback<R(A1, A2)> : public cef_internal::CallbackBase {
|
||||
public:
|
||||
typedef R(RunType)(A1, A2);
|
||||
|
||||
Callback() : CallbackBase(NULL) { }
|
||||
|
||||
// Note that this constructor CANNOT be explicit, and that Bind() CANNOT
|
||||
// return the exact Callback<> type. See base/bind.h for details.
|
||||
template <typename Runnable, typename BindRunType, typename BoundArgsType>
|
||||
Callback(cef_internal::BindState<Runnable, BindRunType,
|
||||
BoundArgsType>* bind_state)
|
||||
: CallbackBase(bind_state) {
|
||||
|
||||
// Force the assignment to a local variable of PolymorphicInvoke
|
||||
// so the compiler will typecheck that the passed in Run() method has
|
||||
// the correct type.
|
||||
PolymorphicInvoke invoke_func =
|
||||
&cef_internal::BindState<Runnable, BindRunType, BoundArgsType>
|
||||
::InvokerType::Run;
|
||||
polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
|
||||
}
|
||||
|
||||
bool Equals(const Callback& other) const {
|
||||
return CallbackBase::Equals(other);
|
||||
}
|
||||
|
||||
R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2) const {
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
|
||||
|
||||
return f(bind_state_.get(), cef_internal::CallbackForward(a1),
|
||||
cef_internal::CallbackForward(a2));
|
||||
}
|
||||
|
||||
private:
|
||||
typedef R(*PolymorphicInvoke)(
|
||||
cef_internal::BindStateBase*,
|
||||
typename cef_internal::CallbackParamTraits<A1>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType);
|
||||
|
||||
};
|
||||
|
||||
template <typename R, typename A1, typename A2, typename A3>
|
||||
class Callback<R(A1, A2, A3)> : public cef_internal::CallbackBase {
|
||||
public:
|
||||
typedef R(RunType)(A1, A2, A3);
|
||||
|
||||
Callback() : CallbackBase(NULL) { }
|
||||
|
||||
// Note that this constructor CANNOT be explicit, and that Bind() CANNOT
|
||||
// return the exact Callback<> type. See base/bind.h for details.
|
||||
template <typename Runnable, typename BindRunType, typename BoundArgsType>
|
||||
Callback(cef_internal::BindState<Runnable, BindRunType,
|
||||
BoundArgsType>* bind_state)
|
||||
: CallbackBase(bind_state) {
|
||||
|
||||
// Force the assignment to a local variable of PolymorphicInvoke
|
||||
// so the compiler will typecheck that the passed in Run() method has
|
||||
// the correct type.
|
||||
PolymorphicInvoke invoke_func =
|
||||
&cef_internal::BindState<Runnable, BindRunType, BoundArgsType>
|
||||
::InvokerType::Run;
|
||||
polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
|
||||
}
|
||||
|
||||
bool Equals(const Callback& other) const {
|
||||
return CallbackBase::Equals(other);
|
||||
}
|
||||
|
||||
R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType a3) const {
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
|
||||
|
||||
return f(bind_state_.get(), cef_internal::CallbackForward(a1),
|
||||
cef_internal::CallbackForward(a2),
|
||||
cef_internal::CallbackForward(a3));
|
||||
}
|
||||
|
||||
private:
|
||||
typedef R(*PolymorphicInvoke)(
|
||||
cef_internal::BindStateBase*,
|
||||
typename cef_internal::CallbackParamTraits<A1>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType);
|
||||
|
||||
};
|
||||
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4>
|
||||
class Callback<R(A1, A2, A3, A4)> : public cef_internal::CallbackBase {
|
||||
public:
|
||||
typedef R(RunType)(A1, A2, A3, A4);
|
||||
|
||||
Callback() : CallbackBase(NULL) { }
|
||||
|
||||
// Note that this constructor CANNOT be explicit, and that Bind() CANNOT
|
||||
// return the exact Callback<> type. See base/bind.h for details.
|
||||
template <typename Runnable, typename BindRunType, typename BoundArgsType>
|
||||
Callback(cef_internal::BindState<Runnable, BindRunType,
|
||||
BoundArgsType>* bind_state)
|
||||
: CallbackBase(bind_state) {
|
||||
|
||||
// Force the assignment to a local variable of PolymorphicInvoke
|
||||
// so the compiler will typecheck that the passed in Run() method has
|
||||
// the correct type.
|
||||
PolymorphicInvoke invoke_func =
|
||||
&cef_internal::BindState<Runnable, BindRunType, BoundArgsType>
|
||||
::InvokerType::Run;
|
||||
polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
|
||||
}
|
||||
|
||||
bool Equals(const Callback& other) const {
|
||||
return CallbackBase::Equals(other);
|
||||
}
|
||||
|
||||
R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType a4) const {
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
|
||||
|
||||
return f(bind_state_.get(), cef_internal::CallbackForward(a1),
|
||||
cef_internal::CallbackForward(a2),
|
||||
cef_internal::CallbackForward(a3),
|
||||
cef_internal::CallbackForward(a4));
|
||||
}
|
||||
|
||||
private:
|
||||
typedef R(*PolymorphicInvoke)(
|
||||
cef_internal::BindStateBase*,
|
||||
typename cef_internal::CallbackParamTraits<A1>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType);
|
||||
|
||||
};
|
||||
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||
typename A5>
|
||||
class Callback<R(A1, A2, A3, A4, A5)> : public cef_internal::CallbackBase {
|
||||
public:
|
||||
typedef R(RunType)(A1, A2, A3, A4, A5);
|
||||
|
||||
Callback() : CallbackBase(NULL) { }
|
||||
|
||||
// Note that this constructor CANNOT be explicit, and that Bind() CANNOT
|
||||
// return the exact Callback<> type. See base/bind.h for details.
|
||||
template <typename Runnable, typename BindRunType, typename BoundArgsType>
|
||||
Callback(cef_internal::BindState<Runnable, BindRunType,
|
||||
BoundArgsType>* bind_state)
|
||||
: CallbackBase(bind_state) {
|
||||
|
||||
// Force the assignment to a local variable of PolymorphicInvoke
|
||||
// so the compiler will typecheck that the passed in Run() method has
|
||||
// the correct type.
|
||||
PolymorphicInvoke invoke_func =
|
||||
&cef_internal::BindState<Runnable, BindRunType, BoundArgsType>
|
||||
::InvokerType::Run;
|
||||
polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
|
||||
}
|
||||
|
||||
bool Equals(const Callback& other) const {
|
||||
return CallbackBase::Equals(other);
|
||||
}
|
||||
|
||||
R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename cef_internal::CallbackParamTraits<A5>::ForwardType a5) const {
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
|
||||
|
||||
return f(bind_state_.get(), cef_internal::CallbackForward(a1),
|
||||
cef_internal::CallbackForward(a2),
|
||||
cef_internal::CallbackForward(a3),
|
||||
cef_internal::CallbackForward(a4),
|
||||
cef_internal::CallbackForward(a5));
|
||||
}
|
||||
|
||||
private:
|
||||
typedef R(*PolymorphicInvoke)(
|
||||
cef_internal::BindStateBase*,
|
||||
typename cef_internal::CallbackParamTraits<A1>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A5>::ForwardType);
|
||||
|
||||
};
|
||||
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||
typename A5, typename A6>
|
||||
class Callback<R(A1, A2, A3, A4, A5, A6)> : public cef_internal::CallbackBase {
|
||||
public:
|
||||
typedef R(RunType)(A1, A2, A3, A4, A5, A6);
|
||||
|
||||
Callback() : CallbackBase(NULL) { }
|
||||
|
||||
// Note that this constructor CANNOT be explicit, and that Bind() CANNOT
|
||||
// return the exact Callback<> type. See base/bind.h for details.
|
||||
template <typename Runnable, typename BindRunType, typename BoundArgsType>
|
||||
Callback(cef_internal::BindState<Runnable, BindRunType,
|
||||
BoundArgsType>* bind_state)
|
||||
: CallbackBase(bind_state) {
|
||||
|
||||
// Force the assignment to a local variable of PolymorphicInvoke
|
||||
// so the compiler will typecheck that the passed in Run() method has
|
||||
// the correct type.
|
||||
PolymorphicInvoke invoke_func =
|
||||
&cef_internal::BindState<Runnable, BindRunType, BoundArgsType>
|
||||
::InvokerType::Run;
|
||||
polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
|
||||
}
|
||||
|
||||
bool Equals(const Callback& other) const {
|
||||
return CallbackBase::Equals(other);
|
||||
}
|
||||
|
||||
R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename cef_internal::CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename cef_internal::CallbackParamTraits<A6>::ForwardType a6) const {
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
|
||||
|
||||
return f(bind_state_.get(), cef_internal::CallbackForward(a1),
|
||||
cef_internal::CallbackForward(a2),
|
||||
cef_internal::CallbackForward(a3),
|
||||
cef_internal::CallbackForward(a4),
|
||||
cef_internal::CallbackForward(a5),
|
||||
cef_internal::CallbackForward(a6));
|
||||
}
|
||||
|
||||
private:
|
||||
typedef R(*PolymorphicInvoke)(
|
||||
cef_internal::BindStateBase*,
|
||||
typename cef_internal::CallbackParamTraits<A1>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A5>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A6>::ForwardType);
|
||||
|
||||
};
|
||||
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||
typename A5, typename A6, typename A7>
|
||||
class Callback<R(A1, A2, A3, A4, A5, A6, A7)> : public cef_internal::CallbackBase {
|
||||
public:
|
||||
typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7);
|
||||
|
||||
Callback() : CallbackBase(NULL) { }
|
||||
|
||||
// Note that this constructor CANNOT be explicit, and that Bind() CANNOT
|
||||
// return the exact Callback<> type. See base/bind.h for details.
|
||||
template <typename Runnable, typename BindRunType, typename BoundArgsType>
|
||||
Callback(cef_internal::BindState<Runnable, BindRunType,
|
||||
BoundArgsType>* bind_state)
|
||||
: CallbackBase(bind_state) {
|
||||
|
||||
// Force the assignment to a local variable of PolymorphicInvoke
|
||||
// so the compiler will typecheck that the passed in Run() method has
|
||||
// the correct type.
|
||||
PolymorphicInvoke invoke_func =
|
||||
&cef_internal::BindState<Runnable, BindRunType, BoundArgsType>
|
||||
::InvokerType::Run;
|
||||
polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
|
||||
}
|
||||
|
||||
bool Equals(const Callback& other) const {
|
||||
return CallbackBase::Equals(other);
|
||||
}
|
||||
|
||||
R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename cef_internal::CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename cef_internal::CallbackParamTraits<A6>::ForwardType a6,
|
||||
typename cef_internal::CallbackParamTraits<A7>::ForwardType a7) const {
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
|
||||
|
||||
return f(bind_state_.get(), cef_internal::CallbackForward(a1),
|
||||
cef_internal::CallbackForward(a2),
|
||||
cef_internal::CallbackForward(a3),
|
||||
cef_internal::CallbackForward(a4),
|
||||
cef_internal::CallbackForward(a5),
|
||||
cef_internal::CallbackForward(a6),
|
||||
cef_internal::CallbackForward(a7));
|
||||
}
|
||||
|
||||
private:
|
||||
typedef R(*PolymorphicInvoke)(
|
||||
cef_internal::BindStateBase*,
|
||||
typename cef_internal::CallbackParamTraits<A1>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A5>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A6>::ForwardType,
|
||||
typename cef_internal::CallbackParamTraits<A7>::ForwardType);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Syntactic sugar to make Callbacks<void(void)> easier to declare since it
|
||||
// will be used in a lot of APIs with delayed execution.
|
||||
typedef Callback<void(void)> Closure;
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_H_
|
@@ -1,59 +0,0 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// 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 INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
|
||||
#define INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_CALLBACK_FORWARD_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/callback_forward.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename Sig>
|
||||
class Callback;
|
||||
|
||||
typedef Callback<void(void)> Closure;
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !!USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
|
@@ -1,93 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// This defines helpful methods for dealing with Callbacks. Because Callbacks
|
||||
// are implemented using templates, with a class per callback signature, adding
|
||||
// methods to Callback<> itself is unattractive (lots of extra code gets
|
||||
// generated). Instead, consider adding methods here.
|
||||
//
|
||||
// ResetAndReturn(&cb) is like cb.Reset() but allows executing a callback (via a
|
||||
// copy) after the original callback is Reset(). This can be handy if Run()
|
||||
// reads/writes the variable holding the Callback.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_CALLBACK_HELPERS_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/callback_helpers.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_basictypes.h"
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_callback.h"
|
||||
#include "include/base/cef_macros.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename Sig>
|
||||
base::Callback<Sig> ResetAndReturn(base::Callback<Sig>* cb) {
|
||||
base::Callback<Sig> ret(*cb);
|
||||
cb->Reset();
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ScopedClosureRunner is akin to scoped_ptr for Closures. It ensures that the
|
||||
// Closure is executed and deleted no matter how the current scope exits.
|
||||
class ScopedClosureRunner {
|
||||
public:
|
||||
ScopedClosureRunner();
|
||||
explicit ScopedClosureRunner(const Closure& closure);
|
||||
~ScopedClosureRunner();
|
||||
|
||||
void Reset();
|
||||
void Reset(const Closure& closure);
|
||||
Closure Release() WARN_UNUSED_RESULT;
|
||||
|
||||
private:
|
||||
Closure closure_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedClosureRunner);
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_
|
@@ -1,444 +0,0 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2013
|
||||
// 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_CALLBACK_LIST_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_CALLBACK_LIST_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/callback_list.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "include/base/cef_basictypes.h"
|
||||
#include "include/base/cef_callback.h"
|
||||
#include "include/base/internal/cef_callback_internal.h"
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_macros.h"
|
||||
#include "include/base/cef_scoped_ptr.h"
|
||||
|
||||
// OVERVIEW:
|
||||
//
|
||||
// A container for a list of callbacks. Unlike a normal STL vector or list,
|
||||
// this container can be modified during iteration without invalidating the
|
||||
// iterator. It safely handles the case of a callback removing itself
|
||||
// or another callback from the list while callbacks are being run.
|
||||
//
|
||||
// TYPICAL USAGE:
|
||||
//
|
||||
// class MyWidget {
|
||||
// public:
|
||||
// ...
|
||||
//
|
||||
// typedef base::Callback<void(const Foo&)> OnFooCallback;
|
||||
//
|
||||
// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
|
||||
// RegisterCallback(const OnFooCallback& cb) {
|
||||
// return callback_list_.Add(cb);
|
||||
// }
|
||||
//
|
||||
// private:
|
||||
// void NotifyFoo(const Foo& foo) {
|
||||
// callback_list_.Notify(foo);
|
||||
// }
|
||||
//
|
||||
// base::CallbackList<void(const Foo&)> callback_list_;
|
||||
//
|
||||
// DISALLOW_COPY_AND_ASSIGN(MyWidget);
|
||||
// };
|
||||
//
|
||||
//
|
||||
// class MyWidgetListener {
|
||||
// public:
|
||||
// MyWidgetListener::MyWidgetListener() {
|
||||
// foo_subscription_ = MyWidget::GetCurrent()->RegisterCallback(
|
||||
// base::Bind(&MyWidgetListener::OnFoo, this)));
|
||||
// }
|
||||
//
|
||||
// MyWidgetListener::~MyWidgetListener() {
|
||||
// // Subscription gets deleted automatically and will deregister
|
||||
// // the callback in the process.
|
||||
// }
|
||||
//
|
||||
// private:
|
||||
// void OnFoo(const Foo& foo) {
|
||||
// // Do something.
|
||||
// }
|
||||
//
|
||||
// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
|
||||
// foo_subscription_;
|
||||
//
|
||||
// DISALLOW_COPY_AND_ASSIGN(MyWidgetListener);
|
||||
// };
|
||||
|
||||
namespace base {
|
||||
|
||||
namespace cef_internal {
|
||||
|
||||
template <typename CallbackType>
|
||||
class CallbackListBase {
|
||||
public:
|
||||
class Subscription {
|
||||
public:
|
||||
Subscription(CallbackListBase<CallbackType>* list,
|
||||
typename std::list<CallbackType>::iterator iter)
|
||||
: list_(list),
|
||||
iter_(iter) {
|
||||
}
|
||||
|
||||
~Subscription() {
|
||||
if (list_->active_iterator_count_) {
|
||||
iter_->Reset();
|
||||
} else {
|
||||
list_->callbacks_.erase(iter_);
|
||||
if (!list_->removal_callback_.is_null())
|
||||
list_->removal_callback_.Run();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
CallbackListBase<CallbackType>* list_;
|
||||
typename std::list<CallbackType>::iterator iter_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Subscription);
|
||||
};
|
||||
|
||||
// Add a callback to the list. The callback will remain registered until the
|
||||
// returned Subscription is destroyed, which must occur before the
|
||||
// CallbackList is destroyed.
|
||||
scoped_ptr<Subscription> Add(const CallbackType& cb) WARN_UNUSED_RESULT {
|
||||
DCHECK(!cb.is_null());
|
||||
return scoped_ptr<Subscription>(
|
||||
new Subscription(this, callbacks_.insert(callbacks_.end(), cb)));
|
||||
}
|
||||
|
||||
// Sets a callback which will be run when a subscription list is changed.
|
||||
void set_removal_callback(const Closure& callback) {
|
||||
removal_callback_ = callback;
|
||||
}
|
||||
|
||||
// Returns true if there are no subscriptions. This is only valid to call when
|
||||
// not looping through the list.
|
||||
bool empty() {
|
||||
DCHECK_EQ(0, active_iterator_count_);
|
||||
return callbacks_.empty();
|
||||
}
|
||||
|
||||
protected:
|
||||
// An iterator class that can be used to access the list of callbacks.
|
||||
class Iterator {
|
||||
public:
|
||||
explicit Iterator(CallbackListBase<CallbackType>* list)
|
||||
: list_(list),
|
||||
list_iter_(list_->callbacks_.begin()) {
|
||||
++list_->active_iterator_count_;
|
||||
}
|
||||
|
||||
Iterator(const Iterator& iter)
|
||||
: list_(iter.list_),
|
||||
list_iter_(iter.list_iter_) {
|
||||
++list_->active_iterator_count_;
|
||||
}
|
||||
|
||||
~Iterator() {
|
||||
if (list_ && --list_->active_iterator_count_ == 0) {
|
||||
list_->Compact();
|
||||
}
|
||||
}
|
||||
|
||||
CallbackType* GetNext() {
|
||||
while ((list_iter_ != list_->callbacks_.end()) && list_iter_->is_null())
|
||||
++list_iter_;
|
||||
|
||||
CallbackType* cb = NULL;
|
||||
if (list_iter_ != list_->callbacks_.end()) {
|
||||
cb = &(*list_iter_);
|
||||
++list_iter_;
|
||||
}
|
||||
return cb;
|
||||
}
|
||||
|
||||
private:
|
||||
CallbackListBase<CallbackType>* list_;
|
||||
typename std::list<CallbackType>::iterator list_iter_;
|
||||
};
|
||||
|
||||
CallbackListBase() : active_iterator_count_(0) {}
|
||||
|
||||
~CallbackListBase() {
|
||||
DCHECK_EQ(0, active_iterator_count_);
|
||||
DCHECK_EQ(0U, callbacks_.size());
|
||||
}
|
||||
|
||||
// Returns an instance of a CallbackListBase::Iterator which can be used
|
||||
// to run callbacks.
|
||||
Iterator GetIterator() {
|
||||
return Iterator(this);
|
||||
}
|
||||
|
||||
// Compact the list: remove any entries which were NULLed out during
|
||||
// iteration.
|
||||
void Compact() {
|
||||
typename std::list<CallbackType>::iterator it = callbacks_.begin();
|
||||
bool updated = false;
|
||||
while (it != callbacks_.end()) {
|
||||
if ((*it).is_null()) {
|
||||
updated = true;
|
||||
it = callbacks_.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
|
||||
if (updated && !removal_callback_.is_null())
|
||||
removal_callback_.Run();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<CallbackType> callbacks_;
|
||||
int active_iterator_count_;
|
||||
Closure removal_callback_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackListBase);
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
|
||||
template <typename Sig> class CallbackList;
|
||||
|
||||
template <>
|
||||
class CallbackList<void(void)>
|
||||
: public cef_internal::CallbackListBase<Callback<void(void)> > {
|
||||
public:
|
||||
typedef Callback<void(void)> CallbackType;
|
||||
|
||||
CallbackList() {}
|
||||
|
||||
void Notify() {
|
||||
cef_internal::CallbackListBase<CallbackType>::Iterator it =
|
||||
this->GetIterator();
|
||||
CallbackType* cb;
|
||||
while ((cb = it.GetNext()) != NULL) {
|
||||
cb->Run();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackList);
|
||||
};
|
||||
|
||||
template <typename A1>
|
||||
class CallbackList<void(A1)>
|
||||
: public cef_internal::CallbackListBase<Callback<void(A1)> > {
|
||||
public:
|
||||
typedef Callback<void(A1)> CallbackType;
|
||||
|
||||
CallbackList() {}
|
||||
|
||||
void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1) {
|
||||
typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
|
||||
this->GetIterator();
|
||||
CallbackType* cb;
|
||||
while ((cb = it.GetNext()) != NULL) {
|
||||
cb->Run(a1);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackList);
|
||||
};
|
||||
|
||||
template <typename A1, typename A2>
|
||||
class CallbackList<void(A1, A2)>
|
||||
: public cef_internal::CallbackListBase<Callback<void(A1, A2)> > {
|
||||
public:
|
||||
typedef Callback<void(A1, A2)> CallbackType;
|
||||
|
||||
CallbackList() {}
|
||||
|
||||
void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2) {
|
||||
typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
|
||||
this->GetIterator();
|
||||
CallbackType* cb;
|
||||
while ((cb = it.GetNext()) != NULL) {
|
||||
cb->Run(a1, a2);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackList);
|
||||
};
|
||||
|
||||
template <typename A1, typename A2, typename A3>
|
||||
class CallbackList<void(A1, A2, A3)>
|
||||
: public cef_internal::CallbackListBase<Callback<void(A1, A2, A3)> > {
|
||||
public:
|
||||
typedef Callback<void(A1, A2, A3)> CallbackType;
|
||||
|
||||
CallbackList() {}
|
||||
|
||||
void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType a3) {
|
||||
typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
|
||||
this->GetIterator();
|
||||
CallbackType* cb;
|
||||
while ((cb = it.GetNext()) != NULL) {
|
||||
cb->Run(a1, a2, a3);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackList);
|
||||
};
|
||||
|
||||
template <typename A1, typename A2, typename A3, typename A4>
|
||||
class CallbackList<void(A1, A2, A3, A4)>
|
||||
: public cef_internal::CallbackListBase<Callback<void(A1, A2, A3, A4)> > {
|
||||
public:
|
||||
typedef Callback<void(A1, A2, A3, A4)> CallbackType;
|
||||
|
||||
CallbackList() {}
|
||||
|
||||
void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType a4) {
|
||||
typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
|
||||
this->GetIterator();
|
||||
CallbackType* cb;
|
||||
while ((cb = it.GetNext()) != NULL) {
|
||||
cb->Run(a1, a2, a3, a4);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackList);
|
||||
};
|
||||
|
||||
template <typename A1, typename A2, typename A3, typename A4, typename A5>
|
||||
class CallbackList<void(A1, A2, A3, A4, A5)>
|
||||
: public cef_internal::CallbackListBase<Callback<void(A1, A2, A3, A4, A5)> > {
|
||||
public:
|
||||
typedef Callback<void(A1, A2, A3, A4, A5)> CallbackType;
|
||||
|
||||
CallbackList() {}
|
||||
|
||||
void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename cef_internal::CallbackParamTraits<A5>::ForwardType a5) {
|
||||
typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
|
||||
this->GetIterator();
|
||||
CallbackType* cb;
|
||||
while ((cb = it.GetNext()) != NULL) {
|
||||
cb->Run(a1, a2, a3, a4, a5);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackList);
|
||||
};
|
||||
|
||||
template <typename A1, typename A2, typename A3, typename A4, typename A5,
|
||||
typename A6>
|
||||
class CallbackList<void(A1, A2, A3, A4, A5, A6)>
|
||||
: public cef_internal::CallbackListBase<Callback<void(A1, A2, A3, A4, A5,
|
||||
A6)> > {
|
||||
public:
|
||||
typedef Callback<void(A1, A2, A3, A4, A5, A6)> CallbackType;
|
||||
|
||||
CallbackList() {}
|
||||
|
||||
void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename cef_internal::CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename cef_internal::CallbackParamTraits<A6>::ForwardType a6) {
|
||||
typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
|
||||
this->GetIterator();
|
||||
CallbackType* cb;
|
||||
while ((cb = it.GetNext()) != NULL) {
|
||||
cb->Run(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackList);
|
||||
};
|
||||
|
||||
template <typename A1, typename A2, typename A3, typename A4, typename A5,
|
||||
typename A6, typename A7>
|
||||
class CallbackList<void(A1, A2, A3, A4, A5, A6, A7)>
|
||||
: public cef_internal::CallbackListBase<Callback<void(A1, A2, A3, A4, A5, A6,
|
||||
A7)> > {
|
||||
public:
|
||||
typedef Callback<void(A1, A2, A3, A4, A5, A6, A7)> CallbackType;
|
||||
|
||||
CallbackList() {}
|
||||
|
||||
void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename cef_internal::CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename cef_internal::CallbackParamTraits<A6>::ForwardType a6,
|
||||
typename cef_internal::CallbackParamTraits<A7>::ForwardType a7) {
|
||||
typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
|
||||
this->GetIterator();
|
||||
CallbackType* cb;
|
||||
while ((cb = it.GetNext()) != NULL) {
|
||||
cb->Run(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackList);
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
|
@@ -1,314 +0,0 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// 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.
|
||||
//
|
||||
// CancelableCallback is a wrapper around base::Callback that allows
|
||||
// cancellation of a callback. CancelableCallback takes a reference on the
|
||||
// wrapped callback until this object is destroyed or Reset()/Cancel() are
|
||||
// called.
|
||||
//
|
||||
// NOTE:
|
||||
//
|
||||
// Calling CancelableCallback::Cancel() brings the object back to its natural,
|
||||
// default-constructed state, i.e., CancelableCallback::callback() will return
|
||||
// a null callback.
|
||||
//
|
||||
// THREAD-SAFETY:
|
||||
//
|
||||
// CancelableCallback objects must be created on, posted to, cancelled on, and
|
||||
// destroyed on the same thread.
|
||||
//
|
||||
//
|
||||
// EXAMPLE USAGE:
|
||||
//
|
||||
// In the following example, the test is verifying that RunIntensiveTest()
|
||||
// Quit()s the message loop within 4 seconds. The cancelable callback is posted
|
||||
// to the message loop, the intensive test runs, the message loop is run,
|
||||
// then the callback is cancelled.
|
||||
//
|
||||
// void TimeoutCallback(const std::string& timeout_message) {
|
||||
// FAIL() << timeout_message;
|
||||
// MessageLoop::current()->QuitWhenIdle();
|
||||
// }
|
||||
//
|
||||
// CancelableClosure timeout(base::Bind(&TimeoutCallback, "Test timed out."));
|
||||
// MessageLoop::current()->PostDelayedTask(FROM_HERE, timeout.callback(),
|
||||
// 4000) // 4 seconds to run.
|
||||
// RunIntensiveTest();
|
||||
// MessageLoop::current()->Run();
|
||||
// timeout.Cancel(); // Hopefully this is hit before the timeout callback runs.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_CANCELABLE_CALLBACK_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/cancelable_callback.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/base/cef_callback.h"
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_macros.h"
|
||||
#include "include/base/cef_weak_ptr.h"
|
||||
#include "include/base/internal/cef_callback_internal.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename Sig>
|
||||
class CancelableCallback;
|
||||
|
||||
template <>
|
||||
class CancelableCallback<void(void)> {
|
||||
public:
|
||||
CancelableCallback() : weak_factory_(this) {}
|
||||
|
||||
// |callback| must not be null.
|
||||
explicit CancelableCallback(const base::Callback<void(void)>& callback)
|
||||
: weak_factory_(this),
|
||||
callback_(callback) {
|
||||
DCHECK(!callback.is_null());
|
||||
InitializeForwarder();
|
||||
}
|
||||
|
||||
~CancelableCallback() {}
|
||||
|
||||
// Cancels and drops the reference to the wrapped callback.
|
||||
void Cancel() {
|
||||
weak_factory_.InvalidateWeakPtrs();
|
||||
forwarder_.Reset();
|
||||
callback_.Reset();
|
||||
}
|
||||
|
||||
// Returns true if the wrapped callback has been cancelled.
|
||||
bool IsCancelled() const {
|
||||
return callback_.is_null();
|
||||
}
|
||||
|
||||
// Sets |callback| as the closure that may be cancelled. |callback| may not
|
||||
// be null. Outstanding and any previously wrapped callbacks are cancelled.
|
||||
void Reset(const base::Callback<void(void)>& callback) {
|
||||
DCHECK(!callback.is_null());
|
||||
|
||||
// Outstanding tasks (e.g., posted to a message loop) must not be called.
|
||||
Cancel();
|
||||
|
||||
// |forwarder_| is no longer valid after Cancel(), so re-bind.
|
||||
InitializeForwarder();
|
||||
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
// Returns a callback that can be disabled by calling Cancel().
|
||||
const base::Callback<void(void)>& callback() const {
|
||||
return forwarder_;
|
||||
}
|
||||
|
||||
private:
|
||||
void Forward() {
|
||||
callback_.Run();
|
||||
}
|
||||
|
||||
// Helper method to bind |forwarder_| using a weak pointer from
|
||||
// |weak_factory_|.
|
||||
void InitializeForwarder() {
|
||||
forwarder_ = base::Bind(&CancelableCallback<void(void)>::Forward,
|
||||
weak_factory_.GetWeakPtr());
|
||||
}
|
||||
|
||||
// Used to ensure Forward() is not run when this object is destroyed.
|
||||
base::WeakPtrFactory<CancelableCallback<void(void)> > weak_factory_;
|
||||
|
||||
// The wrapper closure.
|
||||
base::Callback<void(void)> forwarder_;
|
||||
|
||||
// The stored closure that may be cancelled.
|
||||
base::Callback<void(void)> callback_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CancelableCallback);
|
||||
};
|
||||
|
||||
template <typename A1>
|
||||
class CancelableCallback<void(A1)> {
|
||||
public:
|
||||
CancelableCallback() : weak_factory_(this) {}
|
||||
|
||||
// |callback| must not be null.
|
||||
explicit CancelableCallback(const base::Callback<void(A1)>& callback)
|
||||
: weak_factory_(this),
|
||||
callback_(callback) {
|
||||
DCHECK(!callback.is_null());
|
||||
InitializeForwarder();
|
||||
}
|
||||
|
||||
~CancelableCallback() {}
|
||||
|
||||
// Cancels and drops the reference to the wrapped callback.
|
||||
void Cancel() {
|
||||
weak_factory_.InvalidateWeakPtrs();
|
||||
forwarder_.Reset();
|
||||
callback_.Reset();
|
||||
}
|
||||
|
||||
// Returns true if the wrapped callback has been cancelled.
|
||||
bool IsCancelled() const {
|
||||
return callback_.is_null();
|
||||
}
|
||||
|
||||
// Sets |callback| as the closure that may be cancelled. |callback| may not
|
||||
// be null. Outstanding and any previously wrapped callbacks are cancelled.
|
||||
void Reset(const base::Callback<void(A1)>& callback) {
|
||||
DCHECK(!callback.is_null());
|
||||
|
||||
// Outstanding tasks (e.g., posted to a message loop) must not be called.
|
||||
Cancel();
|
||||
|
||||
// |forwarder_| is no longer valid after Cancel(), so re-bind.
|
||||
InitializeForwarder();
|
||||
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
// Returns a callback that can be disabled by calling Cancel().
|
||||
const base::Callback<void(A1)>& callback() const {
|
||||
return forwarder_;
|
||||
}
|
||||
|
||||
private:
|
||||
void Forward(A1 a1) const {
|
||||
callback_.Run(a1);
|
||||
}
|
||||
|
||||
// Helper method to bind |forwarder_| using a weak pointer from
|
||||
// |weak_factory_|.
|
||||
void InitializeForwarder() {
|
||||
forwarder_ = base::Bind(&CancelableCallback<void(A1)>::Forward,
|
||||
weak_factory_.GetWeakPtr());
|
||||
}
|
||||
|
||||
// Used to ensure Forward() is not run when this object is destroyed.
|
||||
base::WeakPtrFactory<CancelableCallback<void(A1)> > weak_factory_;
|
||||
|
||||
// The wrapper closure.
|
||||
base::Callback<void(A1)> forwarder_;
|
||||
|
||||
// The stored closure that may be cancelled.
|
||||
base::Callback<void(A1)> callback_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CancelableCallback);
|
||||
};
|
||||
|
||||
template <typename A1, typename A2>
|
||||
class CancelableCallback<void(A1, A2)> {
|
||||
public:
|
||||
CancelableCallback() : weak_factory_(this) {}
|
||||
|
||||
// |callback| must not be null.
|
||||
explicit CancelableCallback(const base::Callback<void(A1, A2)>& callback)
|
||||
: weak_factory_(this),
|
||||
callback_(callback) {
|
||||
DCHECK(!callback.is_null());
|
||||
InitializeForwarder();
|
||||
}
|
||||
|
||||
~CancelableCallback() {}
|
||||
|
||||
// Cancels and drops the reference to the wrapped callback.
|
||||
void Cancel() {
|
||||
weak_factory_.InvalidateWeakPtrs();
|
||||
forwarder_.Reset();
|
||||
callback_.Reset();
|
||||
}
|
||||
|
||||
// Returns true if the wrapped callback has been cancelled.
|
||||
bool IsCancelled() const {
|
||||
return callback_.is_null();
|
||||
}
|
||||
|
||||
// Sets |callback| as the closure that may be cancelled. |callback| may not
|
||||
// be null. Outstanding and any previously wrapped callbacks are cancelled.
|
||||
void Reset(const base::Callback<void(A1, A2)>& callback) {
|
||||
DCHECK(!callback.is_null());
|
||||
|
||||
// Outstanding tasks (e.g., posted to a message loop) must not be called.
|
||||
Cancel();
|
||||
|
||||
// |forwarder_| is no longer valid after Cancel(), so re-bind.
|
||||
InitializeForwarder();
|
||||
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
// Returns a callback that can be disabled by calling Cancel().
|
||||
const base::Callback<void(A1, A2)>& callback() const {
|
||||
return forwarder_;
|
||||
}
|
||||
|
||||
private:
|
||||
void Forward(A1 a1, A2 a2) const {
|
||||
callback_.Run(a1, a2);
|
||||
}
|
||||
|
||||
// Helper method to bind |forwarder_| using a weak pointer from
|
||||
// |weak_factory_|.
|
||||
void InitializeForwarder() {
|
||||
forwarder_ = base::Bind(&CancelableCallback<void(A1, A2)>::Forward,
|
||||
weak_factory_.GetWeakPtr());
|
||||
}
|
||||
|
||||
// Used to ensure Forward() is not run when this object is destroyed.
|
||||
base::WeakPtrFactory<CancelableCallback<void(A1, A2)> > weak_factory_;
|
||||
|
||||
// The wrapper closure.
|
||||
base::Callback<void(A1, A2)> forwarder_;
|
||||
|
||||
// The stored closure that may be cancelled.
|
||||
base::Callback<void(A1, A2)> callback_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CancelableCallback);
|
||||
};
|
||||
|
||||
typedef CancelableCallback<void(void)> CancelableClosure;
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
|
@@ -1,178 +0,0 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// 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_LOCK_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_LOCK_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_SYNCHRONIZATION_LOCK_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/synchronization/lock.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_macros.h"
|
||||
#include "include/base/cef_platform_thread.h"
|
||||
#include "include/base/internal/cef_lock_impl.h"
|
||||
|
||||
namespace base {
|
||||
namespace cef_internal {
|
||||
|
||||
// A convenient wrapper for an OS specific critical section. The only real
|
||||
// intelligence in this class is in debug mode for the support for the
|
||||
// AssertAcquired() method.
|
||||
class Lock {
|
||||
public:
|
||||
#if !DCHECK_IS_ON() // Optimized wrapper implementation
|
||||
Lock() : lock_() {}
|
||||
~Lock() {}
|
||||
void Acquire() { lock_.Lock(); }
|
||||
void Release() { lock_.Unlock(); }
|
||||
|
||||
// If the lock is not held, take it and return true. If the lock is already
|
||||
// held by another thread, immediately return false. This must not be called
|
||||
// by a thread already holding the lock (what happens is undefined and an
|
||||
// assertion may fail).
|
||||
bool Try() { return lock_.Try(); }
|
||||
|
||||
// Null implementation if not debug.
|
||||
void AssertAcquired() const {}
|
||||
#else
|
||||
Lock();
|
||||
~Lock();
|
||||
|
||||
// NOTE: Although windows critical sections support recursive locks, we do not
|
||||
// allow this, and we will commonly fire a DCHECK() if a thread attempts to
|
||||
// acquire the lock a second time (while already holding it).
|
||||
void Acquire() {
|
||||
lock_.Lock();
|
||||
CheckUnheldAndMark();
|
||||
}
|
||||
void Release() {
|
||||
CheckHeldAndUnmark();
|
||||
lock_.Unlock();
|
||||
}
|
||||
|
||||
bool Try() {
|
||||
bool rv = lock_.Try();
|
||||
if (rv) {
|
||||
CheckUnheldAndMark();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void AssertAcquired() const;
|
||||
#endif // !DCHECK_IS_ON()
|
||||
|
||||
private:
|
||||
#if DCHECK_IS_ON()
|
||||
// Members and routines taking care of locks assertions.
|
||||
// Note that this checks for recursive locks and allows them
|
||||
// if the variable is set. This is allowed by the underlying implementation
|
||||
// on windows but not on Posix, so we're doing unneeded checks on Posix.
|
||||
// It's worth it to share the code.
|
||||
void CheckHeldAndUnmark();
|
||||
void CheckUnheldAndMark();
|
||||
|
||||
// All private data is implicitly protected by lock_.
|
||||
// Be VERY careful to only access members under that lock.
|
||||
base::PlatformThreadRef owning_thread_ref_;
|
||||
#endif // DCHECK_IS_ON()
|
||||
|
||||
// Platform specific underlying lock implementation.
|
||||
LockImpl lock_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Lock);
|
||||
};
|
||||
|
||||
// A helper class that acquires the given Lock while the AutoLock is in scope.
|
||||
class AutoLock {
|
||||
public:
|
||||
struct AlreadyAcquired {};
|
||||
|
||||
explicit AutoLock(Lock& lock) : lock_(lock) {
|
||||
lock_.Acquire();
|
||||
}
|
||||
|
||||
AutoLock(Lock& lock, const AlreadyAcquired&) : lock_(lock) {
|
||||
lock_.AssertAcquired();
|
||||
}
|
||||
|
||||
~AutoLock() {
|
||||
lock_.AssertAcquired();
|
||||
lock_.Release();
|
||||
}
|
||||
|
||||
private:
|
||||
Lock& lock_;
|
||||
DISALLOW_COPY_AND_ASSIGN(AutoLock);
|
||||
};
|
||||
|
||||
// AutoUnlock is a helper that will Release() the |lock| argument in the
|
||||
// constructor, and re-Acquire() it in the destructor.
|
||||
class AutoUnlock {
|
||||
public:
|
||||
explicit AutoUnlock(Lock& lock) : lock_(lock) {
|
||||
// We require our caller to have the lock.
|
||||
lock_.AssertAcquired();
|
||||
lock_.Release();
|
||||
}
|
||||
|
||||
~AutoUnlock() {
|
||||
lock_.Acquire();
|
||||
}
|
||||
|
||||
private:
|
||||
Lock& lock_;
|
||||
DISALLOW_COPY_AND_ASSIGN(AutoUnlock);
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
|
||||
// Implement classes in the cef_internal namespace and then expose them to the
|
||||
// base namespace. This avoids conflicts with the base.lib implementation when
|
||||
// linking sandbox support on Windows.
|
||||
using cef_internal::Lock;
|
||||
using cef_internal::AutoLock;
|
||||
using cef_internal::AutoUnlock;
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_LOCK_H_
|
@@ -1,752 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// Always define the DCHECK_IS_ON macro which is used from other CEF headers.
|
||||
#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
|
||||
#define DCHECK_IS_ON() 0
|
||||
#else
|
||||
#define DCHECK_IS_ON() 1
|
||||
#endif
|
||||
|
||||
#elif defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/logging.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// 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 {
|
||||
namespace 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 logging
|
||||
} // namespace cef
|
||||
|
||||
// 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 // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_LOGGING_H_
|
@@ -1,220 +0,0 @@
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/macros.h"
|
||||
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// 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.
|
||||
#include "include/base/cef_build.h" // For COMPILER_MSVC
|
||||
|
||||
#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
|
||||
|
||||
#if !defined(DISALLOW_IMPLICIT_CONSTRUCTORS)
|
||||
|
||||
// A macro to disallow all the implicit constructors, namely the
|
||||
// default constructor, copy constructor and operator= functions.
|
||||
//
|
||||
// This should be used in the private: declarations for a class
|
||||
// that wants to prevent anyone from instantiating it. This is
|
||||
// especially useful for classes containing only static methods.
|
||||
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
|
||||
TypeName(); \
|
||||
DISALLOW_COPY_AND_ASSIGN(TypeName)
|
||||
|
||||
#endif // !DISALLOW_IMPLICIT_CONSTRUCTORS
|
||||
|
||||
#if !defined(COMPILE_ASSERT)
|
||||
|
||||
// The COMPILE_ASSERT macro can be used to verify that a compile time
|
||||
// expression is true. For example, you could use it to verify the
|
||||
// size of a static array:
|
||||
//
|
||||
// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES,
|
||||
// content_type_names_incorrect_size);
|
||||
//
|
||||
// or to make sure a struct is smaller than a certain size:
|
||||
//
|
||||
// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
|
||||
//
|
||||
// The second argument to the macro is the name of the variable. If
|
||||
// the expression is false, most compilers will issue a warning/error
|
||||
// containing the name of the variable.
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
|
||||
// Under C++11, just use static_assert.
|
||||
#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
|
||||
|
||||
#else
|
||||
|
||||
namespace cef {
|
||||
|
||||
template <bool>
|
||||
struct CompileAssert {
|
||||
};
|
||||
|
||||
} // namespace cef
|
||||
|
||||
#define COMPILE_ASSERT(expr, msg) \
|
||||
typedef cef::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] \
|
||||
ALLOW_UNUSED_TYPE
|
||||
|
||||
// Implementation details of COMPILE_ASSERT:
|
||||
//
|
||||
// - COMPILE_ASSERT works by defining an array type that has -1
|
||||
// elements (and thus is invalid) when the expression is false.
|
||||
//
|
||||
// - The simpler definition
|
||||
//
|
||||
// #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1]
|
||||
//
|
||||
// does not work, as gcc supports variable-length arrays whose sizes
|
||||
// are determined at run-time (this is gcc's extension and not part
|
||||
// of the C++ standard). As a result, gcc fails to reject the
|
||||
// following code with the simple definition:
|
||||
//
|
||||
// int foo;
|
||||
// COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is
|
||||
// // not a compile-time constant.
|
||||
//
|
||||
// - By using the type CompileAssert<(bool(expr))>, we ensures that
|
||||
// expr is a compile-time constant. (Template arguments must be
|
||||
// determined at compile-time.)
|
||||
//
|
||||
// - The outer parentheses in CompileAssert<(bool(expr))> are necessary
|
||||
// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
|
||||
//
|
||||
// CompileAssert<bool(expr)>
|
||||
//
|
||||
// instead, these compilers will refuse to compile
|
||||
//
|
||||
// COMPILE_ASSERT(5 > 0, some_message);
|
||||
//
|
||||
// (They seem to think the ">" in "5 > 0" marks the end of the
|
||||
// template argument list.)
|
||||
//
|
||||
// - The array size is (bool(expr) ? 1 : -1), instead of simply
|
||||
//
|
||||
// ((expr) ? 1 : -1).
|
||||
//
|
||||
// This is to avoid running into a bug in MS VC 7.1, which
|
||||
// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
|
||||
|
||||
#endif // !(__cplusplus >= 201103L)
|
||||
|
||||
#endif // !defined(COMPILE_ASSERT)
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#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
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_MACROS_H_
|
@@ -1,259 +0,0 @@
|
||||
// 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_MOVE_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_MOVE_H_
|
||||
|
||||
#if defined(MOVE_ONLY_TYPE_FOR_CPP_03)
|
||||
// Do nothing if the macro in this header has already been defined.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/move.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
// Macro with the boilerplate that makes a type move-only in C++03.
|
||||
//
|
||||
// USAGE
|
||||
//
|
||||
// This macro should be used instead of DISALLOW_COPY_AND_ASSIGN to create
|
||||
// a "move-only" type. Unlike DISALLOW_COPY_AND_ASSIGN, this macro should be
|
||||
// the first line in a class declaration.
|
||||
//
|
||||
// A class using this macro must call .Pass() (or somehow be an r-value already)
|
||||
// before it can be:
|
||||
//
|
||||
// * Passed as a function argument
|
||||
// * Used as the right-hand side of an assignment
|
||||
// * Returned from a function
|
||||
//
|
||||
// Each class will still need to define their own "move constructor" and "move
|
||||
// operator=" to make this useful. Here's an example of the macro, the move
|
||||
// constructor, and the move operator= from the scoped_ptr class:
|
||||
//
|
||||
// template <typename T>
|
||||
// class scoped_ptr {
|
||||
// MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue)
|
||||
// public:
|
||||
// scoped_ptr(RValue& other) : ptr_(other.release()) { }
|
||||
// scoped_ptr& operator=(RValue& other) {
|
||||
// swap(other);
|
||||
// return *this;
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// Note that the constructor must NOT be marked explicit.
|
||||
//
|
||||
// For consistency, the second parameter to the macro should always be RValue
|
||||
// unless you have a strong reason to do otherwise. It is only exposed as a
|
||||
// macro parameter so that the move constructor and move operator= don't look
|
||||
// like they're using a phantom type.
|
||||
//
|
||||
//
|
||||
// HOW THIS WORKS
|
||||
//
|
||||
// For a thorough explanation of this technique, see:
|
||||
//
|
||||
// http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Move_Constructor
|
||||
//
|
||||
// The summary is that we take advantage of 2 properties:
|
||||
//
|
||||
// 1) non-const references will not bind to r-values.
|
||||
// 2) C++ can apply one user-defined conversion when initializing a
|
||||
// variable.
|
||||
//
|
||||
// The first lets us disable the copy constructor and assignment operator
|
||||
// by declaring private version of them with a non-const reference parameter.
|
||||
//
|
||||
// For l-values, direct initialization still fails like in
|
||||
// DISALLOW_COPY_AND_ASSIGN because the copy constructor and assignment
|
||||
// operators are private.
|
||||
//
|
||||
// For r-values, the situation is different. The copy constructor and
|
||||
// assignment operator are not viable due to (1), so we are trying to call
|
||||
// a non-existent constructor and non-existing operator= rather than a private
|
||||
// one. Since we have not committed an error quite yet, we can provide an
|
||||
// alternate conversion sequence and a constructor. We add
|
||||
//
|
||||
// * a private struct named "RValue"
|
||||
// * a user-defined conversion "operator RValue()"
|
||||
// * a "move constructor" and "move operator=" that take the RValue& as
|
||||
// their sole parameter.
|
||||
//
|
||||
// Only r-values will trigger this sequence and execute our "move constructor"
|
||||
// or "move operator=." L-values will match the private copy constructor and
|
||||
// operator= first giving a "private in this context" error. This combination
|
||||
// gives us a move-only type.
|
||||
//
|
||||
// For signaling a destructive transfer of data from an l-value, we provide a
|
||||
// method named Pass() which creates an r-value for the current instance
|
||||
// triggering the move constructor or move operator=.
|
||||
//
|
||||
// Other ways to get r-values is to use the result of an expression like a
|
||||
// function call.
|
||||
//
|
||||
// Here's an example with comments explaining what gets triggered where:
|
||||
//
|
||||
// class Foo {
|
||||
// MOVE_ONLY_TYPE_FOR_CPP_03(Foo, RValue);
|
||||
//
|
||||
// public:
|
||||
// ... API ...
|
||||
// Foo(RValue other); // Move constructor.
|
||||
// Foo& operator=(RValue rhs); // Move operator=
|
||||
// };
|
||||
//
|
||||
// Foo MakeFoo(); // Function that returns a Foo.
|
||||
//
|
||||
// Foo f;
|
||||
// Foo f_copy(f); // ERROR: Foo(Foo&) is private in this context.
|
||||
// Foo f_assign;
|
||||
// f_assign = f; // ERROR: operator=(Foo&) is private in this context.
|
||||
//
|
||||
//
|
||||
// Foo f(MakeFoo()); // R-value so alternate conversion executed.
|
||||
// Foo f_copy(f.Pass()); // R-value so alternate conversion executed.
|
||||
// f = f_copy.Pass(); // R-value so alternate conversion executed.
|
||||
//
|
||||
//
|
||||
// IMPLEMENTATION SUBTLETIES WITH RValue
|
||||
//
|
||||
// The RValue struct is just a container for a pointer back to the original
|
||||
// object. It should only ever be created as a temporary, and no external
|
||||
// class should ever declare it or use it in a parameter.
|
||||
//
|
||||
// It is tempting to want to use the RValue type in function parameters, but
|
||||
// excluding the limited usage here for the move constructor and move
|
||||
// operator=, doing so would mean that the function could take both r-values
|
||||
// and l-values equially which is unexpected. See COMPARED To Boost.Move for
|
||||
// more details.
|
||||
//
|
||||
// An alternate, and incorrect, implementation of the RValue class used by
|
||||
// Boost.Move makes RValue a fieldless child of the move-only type. RValue&
|
||||
// is then used in place of RValue in the various operators. The RValue& is
|
||||
// "created" by doing *reinterpret_cast<RValue*>(this). This has the appeal
|
||||
// of never creating a temporary RValue struct even with optimizations
|
||||
// disabled. Also, by virtue of inheritance you can treat the RValue
|
||||
// reference as if it were the move-only type itself. Unfortunately,
|
||||
// using the result of this reinterpret_cast<> is actually undefined behavior
|
||||
// due to C++98 5.2.10.7. In certain compilers (e.g., NaCl) the optimizer
|
||||
// will generate non-working code.
|
||||
//
|
||||
// In optimized builds, both implementations generate the same assembly so we
|
||||
// choose the one that adheres to the standard.
|
||||
//
|
||||
//
|
||||
// WHY HAVE typedef void MoveOnlyTypeForCPP03
|
||||
//
|
||||
// Callback<>/Bind() needs to understand movable-but-not-copyable semantics
|
||||
// to call .Pass() appropriately when it is expected to transfer the value.
|
||||
// The cryptic typedef MoveOnlyTypeForCPP03 is added to make this check
|
||||
// easy and automatic in helper templates for Callback<>/Bind().
|
||||
// See IsMoveOnlyType template and its usage in base/callback_internal.h
|
||||
// for more details.
|
||||
//
|
||||
//
|
||||
// COMPARED TO C++11
|
||||
//
|
||||
// In C++11, you would implement this functionality using an r-value reference
|
||||
// and our .Pass() method would be replaced with a call to std::move().
|
||||
//
|
||||
// This emulation also has a deficiency where it uses up the single
|
||||
// user-defined conversion allowed by C++ during initialization. This can
|
||||
// cause problems in some API edge cases. For instance, in scoped_ptr, it is
|
||||
// impossible to make a function "void Foo(scoped_ptr<Parent> p)" accept a
|
||||
// value of type scoped_ptr<Child> even if you add a constructor to
|
||||
// scoped_ptr<> that would make it look like it should work. C++11 does not
|
||||
// have this deficiency.
|
||||
//
|
||||
//
|
||||
// COMPARED TO Boost.Move
|
||||
//
|
||||
// Our implementation similar to Boost.Move, but we keep the RValue struct
|
||||
// private to the move-only type, and we don't use the reinterpret_cast<> hack.
|
||||
//
|
||||
// In Boost.Move, RValue is the boost::rv<> template. This type can be used
|
||||
// when writing APIs like:
|
||||
//
|
||||
// void MyFunc(boost::rv<Foo>& f)
|
||||
//
|
||||
// that can take advantage of rv<> to avoid extra copies of a type. However you
|
||||
// would still be able to call this version of MyFunc with an l-value:
|
||||
//
|
||||
// Foo f;
|
||||
// MyFunc(f); // Uh oh, we probably just destroyed |f| w/o calling Pass().
|
||||
//
|
||||
// unless someone is very careful to also declare a parallel override like:
|
||||
//
|
||||
// void MyFunc(const Foo& f)
|
||||
//
|
||||
// that would catch the l-values first. This was declared unsafe in C++11 and
|
||||
// a C++11 compiler will explicitly fail MyFunc(f). Unfortunately, we cannot
|
||||
// ensure this in C++03.
|
||||
//
|
||||
// Since we have no need for writing such APIs yet, our implementation keeps
|
||||
// RValue private and uses a .Pass() method to do the conversion instead of
|
||||
// trying to write a version of "std::move()." Writing an API like std::move()
|
||||
// would require the RValue struct to be public.
|
||||
//
|
||||
//
|
||||
// CAVEATS
|
||||
//
|
||||
// If you include a move-only type as a field inside a class that does not
|
||||
// explicitly declare a copy constructor, the containing class's implicit
|
||||
// copy constructor will change from Containing(const Containing&) to
|
||||
// Containing(Containing&). This can cause some unexpected errors.
|
||||
//
|
||||
// http://llvm.org/bugs/show_bug.cgi?id=11528
|
||||
//
|
||||
// The workaround is to explicitly declare your copy constructor.
|
||||
//
|
||||
#define MOVE_ONLY_TYPE_FOR_CPP_03(type, rvalue_type) \
|
||||
private: \
|
||||
struct rvalue_type { \
|
||||
explicit rvalue_type(type* object) : object(object) {} \
|
||||
type* object; \
|
||||
}; \
|
||||
type(type&); \
|
||||
void operator=(type&); \
|
||||
public: \
|
||||
operator rvalue_type() { return rvalue_type(this); } \
|
||||
type Pass() { return type(rvalue_type(this)); } \
|
||||
typedef void MoveOnlyTypeForCPP03; \
|
||||
private:
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_MOVE_H_
|
@@ -1,113 +0,0 @@
|
||||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// 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.
|
||||
|
||||
// WARNING: You should *NOT* be using this class directly. PlatformThread is
|
||||
// the low-level platform-specific abstraction to the OS's threading interface.
|
||||
// You should instead be using a message-loop driven Thread, see thread.h.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
|
||||
#define CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
|
||||
|
||||
#if defined(BASE_THREADING_PLATFORM_THREAD_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/threading/platform_thread.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_basictypes.h"
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/internal/cef_thread_internal.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
// Used for logging. Always an integer value.
|
||||
typedef cef_platform_thread_id_t PlatformThreadId;
|
||||
|
||||
// Used for thread checking and debugging.
|
||||
// Meant to be as fast as possible.
|
||||
// These are produced by PlatformThread::CurrentRef(), and used to later
|
||||
// check if we are on the same thread or not by using ==. These are safe
|
||||
// to copy between threads, but can't be copied to another process as they
|
||||
// have no meaning there. Also, the internal identifier can be re-used
|
||||
// after a thread dies, so a PlatformThreadRef cannot be reliably used
|
||||
// to distinguish a new thread from an old, dead thread.
|
||||
class PlatformThreadRef {
|
||||
public:
|
||||
typedef cef_platform_thread_handle_t RefType;
|
||||
|
||||
PlatformThreadRef()
|
||||
: id_(0) {
|
||||
}
|
||||
|
||||
explicit PlatformThreadRef(RefType id)
|
||||
: id_(id) {
|
||||
}
|
||||
|
||||
bool operator==(PlatformThreadRef other) const {
|
||||
return id_ == other.id_;
|
||||
}
|
||||
|
||||
bool is_null() const {
|
||||
return id_ == 0;
|
||||
}
|
||||
private:
|
||||
RefType id_;
|
||||
};
|
||||
|
||||
// A namespace for low-level thread functions.
|
||||
// Chromium uses a class with static methods but CEF uses an actual namespace
|
||||
// to avoid linker problems with the sandbox libaries on Windows.
|
||||
namespace PlatformThread {
|
||||
|
||||
// Gets the current thread id, which may be useful for logging purposes.
|
||||
inline PlatformThreadId CurrentId() {
|
||||
return cef_get_current_platform_thread_id();
|
||||
}
|
||||
|
||||
// Gets the current thread reference, which can be used to check if
|
||||
// we're on the right thread quickly.
|
||||
inline PlatformThreadRef CurrentRef() {
|
||||
return PlatformThreadRef(cef_get_current_platform_thread_handle());
|
||||
}
|
||||
|
||||
} // namespace PlatformThread
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
|
@@ -1,384 +0,0 @@
|
||||
// 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_REF_COUNTED_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_MEMORY_REF_COUNTED_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/memory/ref_counted.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// 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 "include/base/cef_atomic_ref_count.h"
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_thread_collision_warner.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
namespace cef_subtle {
|
||||
|
||||
class RefCountedBase {
|
||||
public:
|
||||
bool HasOneRef() const { return ref_count_ == 1; }
|
||||
|
||||
protected:
|
||||
RefCountedBase()
|
||||
: ref_count_(0)
|
||||
#if DCHECK_IS_ON()
|
||||
, in_dtor_(false)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
~RefCountedBase() {
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(in_dtor_) << "RefCounted object deleted without calling Release()";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void AddRef() const {
|
||||
// TODO(maruel): Add back once it doesn't assert 500 times/sec.
|
||||
// Current thread books the critical section "AddRelease"
|
||||
// without release it.
|
||||
// DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_);
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(!in_dtor_);
|
||||
#endif
|
||||
++ref_count_;
|
||||
}
|
||||
|
||||
// Returns true if the object should self-delete.
|
||||
bool Release() const {
|
||||
// TODO(maruel): Add back once it doesn't assert 500 times/sec.
|
||||
// Current thread books the critical section "AddRelease"
|
||||
// without release it.
|
||||
// DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_);
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(!in_dtor_);
|
||||
#endif
|
||||
if (--ref_count_ == 0) {
|
||||
#if DCHECK_IS_ON()
|
||||
in_dtor_ = true;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable int ref_count_;
|
||||
#if DCHECK_IS_ON()
|
||||
mutable bool in_dtor_;
|
||||
#endif
|
||||
|
||||
DFAKE_MUTEX(add_release_);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
|
||||
};
|
||||
|
||||
class RefCountedThreadSafeBase {
|
||||
public:
|
||||
bool HasOneRef() const;
|
||||
|
||||
protected:
|
||||
RefCountedThreadSafeBase();
|
||||
~RefCountedThreadSafeBase();
|
||||
|
||||
void AddRef() const;
|
||||
|
||||
// Returns true if the object should self-delete.
|
||||
bool Release() const;
|
||||
|
||||
private:
|
||||
mutable AtomicRefCount ref_count_;
|
||||
#if DCHECK_IS_ON()
|
||||
mutable bool in_dtor_;
|
||||
#endif
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase);
|
||||
};
|
||||
|
||||
} // namespace cef_subtle
|
||||
|
||||
//
|
||||
// A base class for reference counted classes. Otherwise, known as a cheap
|
||||
// knock-off of WebKit's RefCounted<T> class. To use this guy just extend your
|
||||
// class from it like so:
|
||||
//
|
||||
// class MyFoo : public base::RefCounted<MyFoo> {
|
||||
// ...
|
||||
// private:
|
||||
// friend class base::RefCounted<MyFoo>;
|
||||
// ~MyFoo();
|
||||
// };
|
||||
//
|
||||
// You should always make your destructor private, to avoid any code deleting
|
||||
// the object accidently while there are references to it.
|
||||
template <class T>
|
||||
class RefCounted : public cef_subtle::RefCountedBase {
|
||||
public:
|
||||
RefCounted() {}
|
||||
|
||||
void AddRef() const {
|
||||
cef_subtle::RefCountedBase::AddRef();
|
||||
}
|
||||
|
||||
void Release() const {
|
||||
if (cef_subtle::RefCountedBase::Release()) {
|
||||
delete static_cast<const T*>(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
~RefCounted() {}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(RefCounted<T>);
|
||||
};
|
||||
|
||||
// Forward declaration.
|
||||
template <class T, typename Traits> class RefCountedThreadSafe;
|
||||
|
||||
// Default traits for RefCountedThreadSafe<T>. Deletes the object when its ref
|
||||
// count reaches 0. Overload to delete it on a different thread etc.
|
||||
template<typename T>
|
||||
struct DefaultRefCountedThreadSafeTraits {
|
||||
static void Destruct(const T* x) {
|
||||
// Delete through RefCountedThreadSafe to make child classes only need to be
|
||||
// friend with RefCountedThreadSafe instead of this struct, which is an
|
||||
// implementation detail.
|
||||
RefCountedThreadSafe<T,
|
||||
DefaultRefCountedThreadSafeTraits>::DeleteInternal(x);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// A thread-safe variant of RefCounted<T>
|
||||
//
|
||||
// class MyFoo : public base::RefCountedThreadSafe<MyFoo> {
|
||||
// ...
|
||||
// };
|
||||
//
|
||||
// If you're using the default trait, then you should add compile time
|
||||
// asserts that no one else is deleting your object. i.e.
|
||||
// private:
|
||||
// friend class base::RefCountedThreadSafe<MyFoo>;
|
||||
// ~MyFoo();
|
||||
template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T> >
|
||||
class RefCountedThreadSafe : public cef_subtle::RefCountedThreadSafeBase {
|
||||
public:
|
||||
RefCountedThreadSafe() {}
|
||||
|
||||
void AddRef() const {
|
||||
cef_subtle::RefCountedThreadSafeBase::AddRef();
|
||||
}
|
||||
|
||||
void Release() const {
|
||||
if (cef_subtle::RefCountedThreadSafeBase::Release()) {
|
||||
Traits::Destruct(static_cast<const T*>(this));
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
~RefCountedThreadSafe() {}
|
||||
|
||||
private:
|
||||
friend struct DefaultRefCountedThreadSafeTraits<T>;
|
||||
static void DeleteInternal(const T* x) { delete x; }
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafe);
|
||||
};
|
||||
|
||||
//
|
||||
// A thread-safe wrapper for some piece of data so we can place other
|
||||
// things in scoped_refptrs<>.
|
||||
//
|
||||
template<typename T>
|
||||
class RefCountedData
|
||||
: public base::RefCountedThreadSafe< base::RefCountedData<T> > {
|
||||
public:
|
||||
RefCountedData() : data() {}
|
||||
RefCountedData(const T& in_value) : data(in_value) {}
|
||||
|
||||
T data;
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<base::RefCountedData<T> >;
|
||||
~RefCountedData() {}
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
//
|
||||
// A smart pointer class for reference counted objects. Use this class instead
|
||||
// of calling AddRef and Release manually on a reference counted object to
|
||||
// avoid common memory leaks caused by forgetting to Release an object
|
||||
// reference. Sample usage:
|
||||
//
|
||||
// class MyFoo : public RefCounted<MyFoo> {
|
||||
// ...
|
||||
// };
|
||||
//
|
||||
// void some_function() {
|
||||
// scoped_refptr<MyFoo> foo = new MyFoo();
|
||||
// foo->Method(param);
|
||||
// // |foo| is released when this function returns
|
||||
// }
|
||||
//
|
||||
// void some_other_function() {
|
||||
// scoped_refptr<MyFoo> foo = new MyFoo();
|
||||
// ...
|
||||
// foo = NULL; // explicitly releases |foo|
|
||||
// ...
|
||||
// if (foo)
|
||||
// foo->Method(param);
|
||||
// }
|
||||
//
|
||||
// The above examples show how scoped_refptr<T> acts like a pointer to T.
|
||||
// Given two scoped_refptr<T> classes, it is also possible to exchange
|
||||
// references between the two objects, like so:
|
||||
//
|
||||
// {
|
||||
// scoped_refptr<MyFoo> a = new MyFoo();
|
||||
// scoped_refptr<MyFoo> b;
|
||||
//
|
||||
// b.swap(a);
|
||||
// // now, |b| references the MyFoo object, and |a| references NULL.
|
||||
// }
|
||||
//
|
||||
// To make both |a| and |b| in the above example reference the same MyFoo
|
||||
// object, simply use the assignment operator:
|
||||
//
|
||||
// {
|
||||
// scoped_refptr<MyFoo> a = new MyFoo();
|
||||
// scoped_refptr<MyFoo> b;
|
||||
//
|
||||
// b = a;
|
||||
// // now, |a| and |b| each own a reference to the same MyFoo object.
|
||||
// }
|
||||
//
|
||||
template <class T>
|
||||
class scoped_refptr {
|
||||
public:
|
||||
typedef T element_type;
|
||||
|
||||
scoped_refptr() : ptr_(NULL) {
|
||||
}
|
||||
|
||||
scoped_refptr(T* p) : ptr_(p) {
|
||||
if (ptr_)
|
||||
ptr_->AddRef();
|
||||
}
|
||||
|
||||
scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {
|
||||
if (ptr_)
|
||||
ptr_->AddRef();
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) {
|
||||
if (ptr_)
|
||||
ptr_->AddRef();
|
||||
}
|
||||
|
||||
~scoped_refptr() {
|
||||
if (ptr_)
|
||||
ptr_->Release();
|
||||
}
|
||||
|
||||
T* get() const { return ptr_; }
|
||||
|
||||
// Allow scoped_refptr<C> to be used in boolean expression
|
||||
// and comparison operations.
|
||||
operator T*() const { return ptr_; }
|
||||
|
||||
T* operator->() const {
|
||||
assert(ptr_ != NULL);
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
scoped_refptr<T>& operator=(T* p) {
|
||||
// AddRef first so that self assignment should work
|
||||
if (p)
|
||||
p->AddRef();
|
||||
T* old_ptr = ptr_;
|
||||
ptr_ = p;
|
||||
if (old_ptr)
|
||||
old_ptr->Release();
|
||||
return *this;
|
||||
}
|
||||
|
||||
scoped_refptr<T>& operator=(const scoped_refptr<T>& r) {
|
||||
return *this = r.ptr_;
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
scoped_refptr<T>& operator=(const scoped_refptr<U>& r) {
|
||||
return *this = r.get();
|
||||
}
|
||||
|
||||
void swap(T** pp) {
|
||||
T* p = ptr_;
|
||||
ptr_ = *pp;
|
||||
*pp = p;
|
||||
}
|
||||
|
||||
void swap(scoped_refptr<T>& r) {
|
||||
swap(&r.ptr_);
|
||||
}
|
||||
|
||||
protected:
|
||||
T* ptr_;
|
||||
};
|
||||
|
||||
// Handy utility for creating a scoped_refptr<T> out of a T* explicitly without
|
||||
// having to retype all the template arguments
|
||||
template <typename T>
|
||||
scoped_refptr<T> make_scoped_refptr(T* t) {
|
||||
return scoped_refptr<T>(t);
|
||||
}
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_
|
@@ -1,623 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// Scopers help you manage ownership of a pointer, helping you easily manage a
|
||||
// pointer within a scope, and automatically destroying the pointer at the end
|
||||
// of a scope. There are two main classes you will use, which correspond to the
|
||||
// operators new/delete and new[]/delete[].
|
||||
//
|
||||
// Example usage (scoped_ptr<T>):
|
||||
// {
|
||||
// scoped_ptr<Foo> foo(new Foo("wee"));
|
||||
// } // foo goes out of scope, releasing the pointer with it.
|
||||
//
|
||||
// {
|
||||
// scoped_ptr<Foo> foo; // No pointer managed.
|
||||
// foo.reset(new Foo("wee")); // Now a pointer is managed.
|
||||
// foo.reset(new Foo("wee2")); // Foo("wee") was destroyed.
|
||||
// foo.reset(new Foo("wee3")); // Foo("wee2") was destroyed.
|
||||
// foo->Method(); // Foo::Method() called.
|
||||
// foo.get()->Method(); // Foo::Method() called.
|
||||
// SomeFunc(foo.release()); // SomeFunc takes ownership, foo no longer
|
||||
// // manages a pointer.
|
||||
// foo.reset(new Foo("wee4")); // foo manages a pointer again.
|
||||
// foo.reset(); // Foo("wee4") destroyed, foo no longer
|
||||
// // manages a pointer.
|
||||
// } // foo wasn't managing a pointer, so nothing was destroyed.
|
||||
//
|
||||
// Example usage (scoped_ptr<T[]>):
|
||||
// {
|
||||
// scoped_ptr<Foo[]> foo(new Foo[100]);
|
||||
// foo.get()->Method(); // Foo::Method on the 0th element.
|
||||
// foo[10].Method(); // Foo::Method on the 10th element.
|
||||
// }
|
||||
//
|
||||
// These scopers also implement part of the functionality of C++11 unique_ptr
|
||||
// in that they are "movable but not copyable." You can use the scopers in
|
||||
// the parameter and return types of functions to signify ownership transfer
|
||||
// in to and out of a function. When calling a function that has a scoper
|
||||
// as the argument type, it must be called with the result of an analogous
|
||||
// scoper's Pass() function or another function that generates a temporary;
|
||||
// passing by copy will NOT work. Here is an example using scoped_ptr:
|
||||
//
|
||||
// void TakesOwnership(scoped_ptr<Foo> arg) {
|
||||
// // Do something with arg
|
||||
// }
|
||||
// scoped_ptr<Foo> CreateFoo() {
|
||||
// // No need for calling Pass() because we are constructing a temporary
|
||||
// // for the return value.
|
||||
// return scoped_ptr<Foo>(new Foo("new"));
|
||||
// }
|
||||
// scoped_ptr<Foo> PassThru(scoped_ptr<Foo> arg) {
|
||||
// return arg.Pass();
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// scoped_ptr<Foo> ptr(new Foo("yay")); // ptr manages Foo("yay").
|
||||
// TakesOwnership(ptr.Pass()); // ptr no longer owns Foo("yay").
|
||||
// scoped_ptr<Foo> ptr2 = CreateFoo(); // ptr2 owns the return Foo.
|
||||
// scoped_ptr<Foo> ptr3 = // ptr3 now owns what was in ptr2.
|
||||
// PassThru(ptr2.Pass()); // ptr2 is correspondingly NULL.
|
||||
// }
|
||||
//
|
||||
// Notice that if you do not call Pass() when returning from PassThru(), or
|
||||
// when invoking TakesOwnership(), the code will not compile because scopers
|
||||
// are not copyable; they only implement move semantics which require calling
|
||||
// the Pass() function to signify a destructive transfer of state. CreateFoo()
|
||||
// is different though because we are constructing a temporary on the return
|
||||
// line and thus can avoid needing to call Pass().
|
||||
//
|
||||
// Pass() properly handles upcast in initialization, i.e. you can use a
|
||||
// scoped_ptr<Child> to initialize a scoped_ptr<Parent>:
|
||||
//
|
||||
// scoped_ptr<Foo> foo(new Foo());
|
||||
// scoped_ptr<FooParent> parent(foo.Pass());
|
||||
//
|
||||
// PassAs<>() should be used to upcast return value in return statement:
|
||||
//
|
||||
// scoped_ptr<Foo> CreateFoo() {
|
||||
// scoped_ptr<FooChild> result(new FooChild());
|
||||
// return result.PassAs<Foo>();
|
||||
// }
|
||||
//
|
||||
// Note that PassAs<>() is implemented only for scoped_ptr<T>, but not for
|
||||
// scoped_ptr<T[]>. This is because casting array pointers may not be safe.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_MEMORY_SCOPED_PTR_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_MEMORY_SCOPED_PTR_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BASE_MEMORY_SCOPED_PTR_H_)
|
||||
// Do nothing if the Chromium header has already been included.
|
||||
// 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(USING_CHROMIUM_INCLUDES)
|
||||
// Do nothing when building CEF.
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
// This is an implementation designed to match the anticipated future TR2
|
||||
// implementation of the scoped_ptr class.
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <algorithm> // For std::swap().
|
||||
|
||||
#include "include/base/cef_basictypes.h"
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_macros.h"
|
||||
#include "include/base/cef_move.h"
|
||||
#include "include/base/cef_template_util.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
namespace subtle {
|
||||
class RefCountedBase;
|
||||
class RefCountedThreadSafeBase;
|
||||
} // namespace subtle
|
||||
|
||||
// Function object which deletes its parameter, which must be a pointer.
|
||||
// If C is an array type, invokes 'delete[]' on the parameter; otherwise,
|
||||
// invokes 'delete'. The default deleter for scoped_ptr<T>.
|
||||
template <class T>
|
||||
struct DefaultDeleter {
|
||||
DefaultDeleter() {}
|
||||
template <typename U> DefaultDeleter(const DefaultDeleter<U>& other) {
|
||||
// IMPLEMENTATION NOTE: C++11 20.7.1.1.2p2 only provides this constructor
|
||||
// if U* is implicitly convertible to T* and U is not an array type.
|
||||
//
|
||||
// Correct implementation should use SFINAE to disable this
|
||||
// constructor. However, since there are no other 1-argument constructors,
|
||||
// using a COMPILE_ASSERT() based on is_convertible<> and requiring
|
||||
// complete types is simpler and will cause compile failures for equivalent
|
||||
// misuses.
|
||||
//
|
||||
// Note, the is_convertible<U*, T*> check also ensures that U is not an
|
||||
// array. T is guaranteed to be a non-array, so any U* where U is an array
|
||||
// cannot convert to T*.
|
||||
enum { T_must_be_complete = sizeof(T) };
|
||||
enum { U_must_be_complete = sizeof(U) };
|
||||
COMPILE_ASSERT((base::is_convertible<U*, T*>::value),
|
||||
U_ptr_must_implicitly_convert_to_T_ptr);
|
||||
}
|
||||
inline void operator()(T* ptr) const {
|
||||
enum { type_must_be_complete = sizeof(T) };
|
||||
delete ptr;
|
||||
}
|
||||
};
|
||||
|
||||
// Specialization of DefaultDeleter for array types.
|
||||
template <class T>
|
||||
struct DefaultDeleter<T[]> {
|
||||
inline void operator()(T* ptr) const {
|
||||
enum { type_must_be_complete = sizeof(T) };
|
||||
delete[] ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
// Disable this operator for any U != T because it is undefined to execute
|
||||
// an array delete when the static type of the array mismatches the dynamic
|
||||
// type.
|
||||
//
|
||||
// References:
|
||||
// C++98 [expr.delete]p3
|
||||
// http://cplusplus.github.com/LWG/lwg-defects.html#938
|
||||
template <typename U> void operator()(U* array) const;
|
||||
};
|
||||
|
||||
template <class T, int n>
|
||||
struct DefaultDeleter<T[n]> {
|
||||
// Never allow someone to declare something like scoped_ptr<int[10]>.
|
||||
COMPILE_ASSERT(sizeof(T) == -1, do_not_use_array_with_size_as_type);
|
||||
};
|
||||
|
||||
// Function object which invokes 'free' on its parameter, which must be
|
||||
// a pointer. Can be used to store malloc-allocated pointers in scoped_ptr:
|
||||
//
|
||||
// scoped_ptr<int, base::FreeDeleter> foo_ptr(
|
||||
// static_cast<int*>(malloc(sizeof(int))));
|
||||
struct FreeDeleter {
|
||||
inline void operator()(void* ptr) const {
|
||||
free(ptr);
|
||||
}
|
||||
};
|
||||
|
||||
namespace cef_internal {
|
||||
|
||||
template <typename T> struct IsNotRefCounted {
|
||||
enum {
|
||||
value = !base::is_convertible<T*, base::subtle::RefCountedBase*>::value &&
|
||||
!base::is_convertible<T*, base::subtle::RefCountedThreadSafeBase*>::
|
||||
value
|
||||
};
|
||||
};
|
||||
|
||||
// Minimal implementation of the core logic of scoped_ptr, suitable for
|
||||
// reuse in both scoped_ptr and its specializations.
|
||||
template <class T, class D>
|
||||
class scoped_ptr_impl {
|
||||
public:
|
||||
explicit scoped_ptr_impl(T* p) : data_(p) { }
|
||||
|
||||
// Initializer for deleters that have data parameters.
|
||||
scoped_ptr_impl(T* p, const D& d) : data_(p, d) {}
|
||||
|
||||
// Templated constructor that destructively takes the value from another
|
||||
// scoped_ptr_impl.
|
||||
template <typename U, typename V>
|
||||
scoped_ptr_impl(scoped_ptr_impl<U, V>* other)
|
||||
: data_(other->release(), other->get_deleter()) {
|
||||
// We do not support move-only deleters. We could modify our move
|
||||
// emulation to have base::subtle::move() and base::subtle::forward()
|
||||
// functions that are imperfect emulations of their C++11 equivalents,
|
||||
// but until there's a requirement, just assume deleters are copyable.
|
||||
}
|
||||
|
||||
template <typename U, typename V>
|
||||
void TakeState(scoped_ptr_impl<U, V>* other) {
|
||||
// See comment in templated constructor above regarding lack of support
|
||||
// for move-only deleters.
|
||||
reset(other->release());
|
||||
get_deleter() = other->get_deleter();
|
||||
}
|
||||
|
||||
~scoped_ptr_impl() {
|
||||
if (data_.ptr != NULL) {
|
||||
// Not using get_deleter() saves one function call in non-optimized
|
||||
// builds.
|
||||
static_cast<D&>(data_)(data_.ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void reset(T* p) {
|
||||
// This is a self-reset, which is no longer allowed: http://crbug.com/162971
|
||||
if (p != NULL && p == data_.ptr)
|
||||
abort();
|
||||
|
||||
// Note that running data_.ptr = p can lead to undefined behavior if
|
||||
// get_deleter()(get()) deletes this. In order to prevent this, reset()
|
||||
// should update the stored pointer before deleting its old value.
|
||||
//
|
||||
// However, changing reset() to use that behavior may cause current code to
|
||||
// break in unexpected ways. If the destruction of the owned object
|
||||
// dereferences the scoped_ptr when it is destroyed by a call to reset(),
|
||||
// then it will incorrectly dispatch calls to |p| rather than the original
|
||||
// value of |data_.ptr|.
|
||||
//
|
||||
// During the transition period, set the stored pointer to NULL while
|
||||
// deleting the object. Eventually, this safety check will be removed to
|
||||
// prevent the scenario initially described from occuring and
|
||||
// http://crbug.com/176091 can be closed.
|
||||
T* old = data_.ptr;
|
||||
data_.ptr = NULL;
|
||||
if (old != NULL)
|
||||
static_cast<D&>(data_)(old);
|
||||
data_.ptr = p;
|
||||
}
|
||||
|
||||
T* get() const { return data_.ptr; }
|
||||
|
||||
D& get_deleter() { return data_; }
|
||||
const D& get_deleter() const { return data_; }
|
||||
|
||||
void swap(scoped_ptr_impl& p2) {
|
||||
// Standard swap idiom: 'using std::swap' ensures that std::swap is
|
||||
// present in the overload set, but we call swap unqualified so that
|
||||
// any more-specific overloads can be used, if available.
|
||||
using std::swap;
|
||||
swap(static_cast<D&>(data_), static_cast<D&>(p2.data_));
|
||||
swap(data_.ptr, p2.data_.ptr);
|
||||
}
|
||||
|
||||
T* release() {
|
||||
T* old_ptr = data_.ptr;
|
||||
data_.ptr = NULL;
|
||||
return old_ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
// Needed to allow type-converting constructor.
|
||||
template <typename U, typename V> friend class scoped_ptr_impl;
|
||||
|
||||
// Use the empty base class optimization to allow us to have a D
|
||||
// member, while avoiding any space overhead for it when D is an
|
||||
// empty class. See e.g. http://www.cantrip.org/emptyopt.html for a good
|
||||
// discussion of this technique.
|
||||
struct Data : public D {
|
||||
explicit Data(T* ptr_in) : ptr(ptr_in) {}
|
||||
Data(T* ptr_in, const D& other) : D(other), ptr(ptr_in) {}
|
||||
T* ptr;
|
||||
};
|
||||
|
||||
Data data_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(scoped_ptr_impl);
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
|
||||
} // namespace base
|
||||
|
||||
// A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
|
||||
// automatically deletes the pointer it holds (if any).
|
||||
// That is, scoped_ptr<T> owns the T object that it points to.
|
||||
// Like a T*, a scoped_ptr<T> may hold either NULL or a pointer to a T object.
|
||||
// Also like T*, scoped_ptr<T> is thread-compatible, and once you
|
||||
// dereference it, you get the thread safety guarantees of T.
|
||||
//
|
||||
// The size of scoped_ptr is small. On most compilers, when using the
|
||||
// DefaultDeleter, sizeof(scoped_ptr<T>) == sizeof(T*). Custom deleters will
|
||||
// increase the size proportional to whatever state they need to have. See
|
||||
// comments inside scoped_ptr_impl<> for details.
|
||||
//
|
||||
// Current implementation targets having a strict subset of C++11's
|
||||
// unique_ptr<> features. Known deficiencies include not supporting move-only
|
||||
// deleteres, function pointers as deleters, and deleters with reference
|
||||
// types.
|
||||
template <class T, class D = base::DefaultDeleter<T> >
|
||||
class scoped_ptr {
|
||||
MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue)
|
||||
|
||||
COMPILE_ASSERT(base::cef_internal::IsNotRefCounted<T>::value,
|
||||
T_is_refcounted_type_and_needs_scoped_refptr);
|
||||
|
||||
public:
|
||||
// The element and deleter types.
|
||||
typedef T element_type;
|
||||
typedef D deleter_type;
|
||||
|
||||
// Constructor. Defaults to initializing with NULL.
|
||||
scoped_ptr() : impl_(NULL) { }
|
||||
|
||||
// Constructor. Takes ownership of p.
|
||||
explicit scoped_ptr(element_type* p) : impl_(p) { }
|
||||
|
||||
// Constructor. Allows initialization of a stateful deleter.
|
||||
scoped_ptr(element_type* p, const D& d) : impl_(p, d) { }
|
||||
|
||||
// Constructor. Allows construction from a scoped_ptr rvalue for a
|
||||
// convertible type and deleter.
|
||||
//
|
||||
// IMPLEMENTATION NOTE: C++11 unique_ptr<> keeps this constructor distinct
|
||||
// from the normal move constructor. By C++11 20.7.1.2.1.21, this constructor
|
||||
// has different post-conditions if D is a reference type. Since this
|
||||
// implementation does not support deleters with reference type,
|
||||
// we do not need a separate move constructor allowing us to avoid one
|
||||
// use of SFINAE. You only need to care about this if you modify the
|
||||
// implementation of scoped_ptr.
|
||||
template <typename U, typename V>
|
||||
scoped_ptr(scoped_ptr<U, V> other) : impl_(&other.impl_) {
|
||||
COMPILE_ASSERT(!base::is_array<U>::value, U_cannot_be_an_array);
|
||||
}
|
||||
|
||||
// Constructor. Move constructor for C++03 move emulation of this type.
|
||||
scoped_ptr(RValue rvalue) : impl_(&rvalue.object->impl_) { }
|
||||
|
||||
// operator=. Allows assignment from a scoped_ptr rvalue for a convertible
|
||||
// type and deleter.
|
||||
//
|
||||
// IMPLEMENTATION NOTE: C++11 unique_ptr<> keeps this operator= distinct from
|
||||
// the normal move assignment operator. By C++11 20.7.1.2.3.4, this templated
|
||||
// form has different requirements on for move-only Deleters. Since this
|
||||
// implementation does not support move-only Deleters, we do not need a
|
||||
// separate move assignment operator allowing us to avoid one use of SFINAE.
|
||||
// You only need to care about this if you modify the implementation of
|
||||
// scoped_ptr.
|
||||
template <typename U, typename V>
|
||||
scoped_ptr& operator=(scoped_ptr<U, V> rhs) {
|
||||
COMPILE_ASSERT(!base::is_array<U>::value, U_cannot_be_an_array);
|
||||
impl_.TakeState(&rhs.impl_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Reset. Deletes the currently owned object, if any.
|
||||
// Then takes ownership of a new object, if given.
|
||||
void reset(element_type* p = NULL) { impl_.reset(p); }
|
||||
|
||||
// Accessors to get the owned object.
|
||||
// operator* and operator-> will assert() if there is no current object.
|
||||
element_type& operator*() const {
|
||||
assert(impl_.get() != NULL);
|
||||
return *impl_.get();
|
||||
}
|
||||
element_type* operator->() const {
|
||||
assert(impl_.get() != NULL);
|
||||
return impl_.get();
|
||||
}
|
||||
element_type* get() const { return impl_.get(); }
|
||||
|
||||
// Access to the deleter.
|
||||
deleter_type& get_deleter() { return impl_.get_deleter(); }
|
||||
const deleter_type& get_deleter() const { return impl_.get_deleter(); }
|
||||
|
||||
// Allow scoped_ptr<element_type> to be used in boolean expressions, but not
|
||||
// implicitly convertible to a real bool (which is dangerous).
|
||||
//
|
||||
// Note that this trick is only safe when the == and != operators
|
||||
// are declared explicitly, as otherwise "scoped_ptr1 ==
|
||||
// scoped_ptr2" will compile but do the wrong thing (i.e., convert
|
||||
// to Testable and then do the comparison).
|
||||
private:
|
||||
typedef base::cef_internal::scoped_ptr_impl<element_type, deleter_type>
|
||||
scoped_ptr::*Testable;
|
||||
|
||||
public:
|
||||
operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; }
|
||||
|
||||
// Comparison operators.
|
||||
// These return whether two scoped_ptr refer to the same object, not just to
|
||||
// two different but equal objects.
|
||||
bool operator==(const element_type* p) const { return impl_.get() == p; }
|
||||
bool operator!=(const element_type* p) const { return impl_.get() != p; }
|
||||
|
||||
// Swap two scoped pointers.
|
||||
void swap(scoped_ptr& p2) {
|
||||
impl_.swap(p2.impl_);
|
||||
}
|
||||
|
||||
// Release a pointer.
|
||||
// The return value is the current pointer held by this object.
|
||||
// If this object holds a NULL pointer, the return value is NULL.
|
||||
// After this operation, this object will hold a NULL pointer,
|
||||
// and will not own the object any more.
|
||||
element_type* release() WARN_UNUSED_RESULT {
|
||||
return impl_.release();
|
||||
}
|
||||
|
||||
// C++98 doesn't support functions templates with default parameters which
|
||||
// makes it hard to write a PassAs() that understands converting the deleter
|
||||
// while preserving simple calling semantics.
|
||||
//
|
||||
// Until there is a use case for PassAs() with custom deleters, just ignore
|
||||
// the custom deleter.
|
||||
template <typename PassAsType>
|
||||
scoped_ptr<PassAsType> PassAs() {
|
||||
return scoped_ptr<PassAsType>(Pass());
|
||||
}
|
||||
|
||||
private:
|
||||
// Needed to reach into |impl_| in the constructor.
|
||||
template <typename U, typename V> friend class scoped_ptr;
|
||||
base::cef_internal::scoped_ptr_impl<element_type, deleter_type> impl_;
|
||||
|
||||
// Forbidden for API compatibility with std::unique_ptr.
|
||||
explicit scoped_ptr(int disallow_construction_from_null);
|
||||
|
||||
// Forbid comparison of scoped_ptr types. If U != T, it totally
|
||||
// doesn't make sense, and if U == T, it still doesn't make sense
|
||||
// because you should never have the same object owned by two different
|
||||
// scoped_ptrs.
|
||||
template <class U> bool operator==(scoped_ptr<U> const& p2) const;
|
||||
template <class U> bool operator!=(scoped_ptr<U> const& p2) const;
|
||||
};
|
||||
|
||||
template <class T, class D>
|
||||
class scoped_ptr<T[], D> {
|
||||
MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue)
|
||||
|
||||
public:
|
||||
// The element and deleter types.
|
||||
typedef T element_type;
|
||||
typedef D deleter_type;
|
||||
|
||||
// Constructor. Defaults to initializing with NULL.
|
||||
scoped_ptr() : impl_(NULL) { }
|
||||
|
||||
// Constructor. Stores the given array. Note that the argument's type
|
||||
// must exactly match T*. In particular:
|
||||
// - it cannot be a pointer to a type derived from T, because it is
|
||||
// inherently unsafe in the general case to access an array through a
|
||||
// pointer whose dynamic type does not match its static type (eg., if
|
||||
// T and the derived types had different sizes access would be
|
||||
// incorrectly calculated). Deletion is also always undefined
|
||||
// (C++98 [expr.delete]p3). If you're doing this, fix your code.
|
||||
// - it cannot be NULL, because NULL is an integral expression, not a
|
||||
// pointer to T. Use the no-argument version instead of explicitly
|
||||
// passing NULL.
|
||||
// - it cannot be const-qualified differently from T per unique_ptr spec
|
||||
// (http://cplusplus.github.com/LWG/lwg-active.html#2118). Users wanting
|
||||
// to work around this may use implicit_cast<const T*>().
|
||||
// However, because of the first bullet in this comment, users MUST
|
||||
// NOT use implicit_cast<Base*>() to upcast the static type of the array.
|
||||
explicit scoped_ptr(element_type* array) : impl_(array) { }
|
||||
|
||||
// Constructor. Move constructor for C++03 move emulation of this type.
|
||||
scoped_ptr(RValue rvalue) : impl_(&rvalue.object->impl_) { }
|
||||
|
||||
// operator=. Move operator= for C++03 move emulation of this type.
|
||||
scoped_ptr& operator=(RValue rhs) {
|
||||
impl_.TakeState(&rhs.object->impl_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Reset. Deletes the currently owned array, if any.
|
||||
// Then takes ownership of a new object, if given.
|
||||
void reset(element_type* array = NULL) { impl_.reset(array); }
|
||||
|
||||
// Accessors to get the owned array.
|
||||
element_type& operator[](size_t i) const {
|
||||
assert(impl_.get() != NULL);
|
||||
return impl_.get()[i];
|
||||
}
|
||||
element_type* get() const { return impl_.get(); }
|
||||
|
||||
// Access to the deleter.
|
||||
deleter_type& get_deleter() { return impl_.get_deleter(); }
|
||||
const deleter_type& get_deleter() const { return impl_.get_deleter(); }
|
||||
|
||||
// Allow scoped_ptr<element_type> to be used in boolean expressions, but not
|
||||
// implicitly convertible to a real bool (which is dangerous).
|
||||
private:
|
||||
typedef base::cef_internal::scoped_ptr_impl<element_type, deleter_type>
|
||||
scoped_ptr::*Testable;
|
||||
|
||||
public:
|
||||
operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; }
|
||||
|
||||
// Comparison operators.
|
||||
// These return whether two scoped_ptr refer to the same object, not just to
|
||||
// two different but equal objects.
|
||||
bool operator==(element_type* array) const { return impl_.get() == array; }
|
||||
bool operator!=(element_type* array) const { return impl_.get() != array; }
|
||||
|
||||
// Swap two scoped pointers.
|
||||
void swap(scoped_ptr& p2) {
|
||||
impl_.swap(p2.impl_);
|
||||
}
|
||||
|
||||
// Release a pointer.
|
||||
// The return value is the current pointer held by this object.
|
||||
// If this object holds a NULL pointer, the return value is NULL.
|
||||
// After this operation, this object will hold a NULL pointer,
|
||||
// and will not own the object any more.
|
||||
element_type* release() WARN_UNUSED_RESULT {
|
||||
return impl_.release();
|
||||
}
|
||||
|
||||
private:
|
||||
// Force element_type to be a complete type.
|
||||
enum { type_must_be_complete = sizeof(element_type) };
|
||||
|
||||
// Actually hold the data.
|
||||
base::cef_internal::scoped_ptr_impl<element_type, deleter_type> impl_;
|
||||
|
||||
// Disable initialization from any type other than element_type*, by
|
||||
// providing a constructor that matches such an initialization, but is
|
||||
// private and has no definition. This is disabled because it is not safe to
|
||||
// call delete[] on an array whose static type does not match its dynamic
|
||||
// type.
|
||||
template <typename U> explicit scoped_ptr(U* array);
|
||||
explicit scoped_ptr(int disallow_construction_from_null);
|
||||
|
||||
// Disable reset() from any type other than element_type*, for the same
|
||||
// reasons as the constructor above.
|
||||
template <typename U> void reset(U* array);
|
||||
void reset(int disallow_reset_from_null);
|
||||
|
||||
// Forbid comparison of scoped_ptr types. If U != T, it totally
|
||||
// doesn't make sense, and if U == T, it still doesn't make sense
|
||||
// because you should never have the same object owned by two different
|
||||
// scoped_ptrs.
|
||||
template <class U> bool operator==(scoped_ptr<U> const& p2) const;
|
||||
template <class U> bool operator!=(scoped_ptr<U> const& p2) const;
|
||||
};
|
||||
|
||||
// Free functions
|
||||
template <class T, class D>
|
||||
void swap(scoped_ptr<T, D>& p1, scoped_ptr<T, D>& p2) {
|
||||
p1.swap(p2);
|
||||
}
|
||||
|
||||
template <class T, class D>
|
||||
bool operator==(T* p1, const scoped_ptr<T, D>& p2) {
|
||||
return p1 == p2.get();
|
||||
}
|
||||
|
||||
template <class T, class D>
|
||||
bool operator!=(T* p1, const scoped_ptr<T, D>& p2) {
|
||||
return p1 != p2.get();
|
||||
}
|
||||
|
||||
// A function to convert T* into scoped_ptr<T>
|
||||
// Doing e.g. make_scoped_ptr(new FooBarBaz<type>(arg)) is a shorter notation
|
||||
// for scoped_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
|
||||
template <typename T>
|
||||
scoped_ptr<T> make_scoped_ptr(T* ptr) {
|
||||
return scoped_ptr<T>(ptr);
|
||||
}
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_MEMORY_SCOPED_PTR_H_
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user