Various fixes related to the C++11/14 update (see issue #3140)

- Convert scoped_ptr to std::unique_ptr from <memory>
- Convert arraysize to base::size from include/base/cef_cxx17_backports.h
- Convert NULL to nullptr
- Include include/base/cef_callback.h instead of include/base/cef_bind.h
- Implicit conversion of CefRefPtr<T> or scoped_refptr<T> to T* is gone;
  use .get() instead

See the issue for additional details.
This commit is contained in:
Marshall Greenblatt
2021-06-17 16:08:01 -04:00
parent 5d438ced79
commit 17fc2b3e3b
141 changed files with 580 additions and 627 deletions

View File

@@ -10,7 +10,6 @@
#include "include/base/cef_macros.h"
#include "include/capi/cef_base_capi.h"
#include "include/cef_base.h"
#include "libcef_dll/ptr_util.h"
#include "libcef_dll/wrapper_types.h"
// Wrap a C++ class with a C structure. This is used when the class

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=a102f383e3ecac5237310b2e5aa5b2fd37474188$
// $hash=982f16fd8ec5c6a195f24f6aaeac41b2e1373f68$
//
#include "libcef_dll/cpptoc/test/translator_test_cpptoc.h"
@@ -1152,7 +1152,7 @@ translator_test_get_own_ptr_library(struct _cef_translator_test_t* self,
CefTranslatorTestCppToC::Get(self)->GetOwnPtrLibrary(val);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval));
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(std::move(_retval));
}
int CEF_CALLBACK translator_test_set_own_ptr_library(
@@ -1200,7 +1200,7 @@ translator_test_set_own_ptr_library_and_return(
CefTranslatorTestScopedLibraryCppToC::UnwrapOwn(val));
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval));
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(std::move(_retval));
}
int CEF_CALLBACK translator_test_set_child_own_ptr_library(
@@ -1248,7 +1248,7 @@ translator_test_set_child_own_ptr_library_and_return_parent(
CefTranslatorTestScopedLibraryChildCppToC::UnwrapOwn(val));
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval));
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(std::move(_retval));
}
int CEF_CALLBACK translator_test_set_own_ptr_client(
@@ -1272,7 +1272,7 @@ int CEF_CALLBACK translator_test_set_own_ptr_client(
// Execute
int _retval =
CefTranslatorTestCppToC::Get(self)->SetOwnPtrClient(OWN_PASS(valPtr));
CefTranslatorTestCppToC::Get(self)->SetOwnPtrClient(std::move(valPtr));
// Return type: simple
return _retval;
@@ -1301,10 +1301,10 @@ translator_test_set_own_ptr_client_and_return(
// Execute
CefOwnPtr<CefTranslatorTestScopedClient> _retval =
CefTranslatorTestCppToC::Get(self)->SetOwnPtrClientAndReturn(
OWN_PASS(valPtr));
std::move(valPtr));
// Return type: ownptr_diff
return CefTranslatorTestScopedClientCToCpp::UnwrapOwn(OWN_PASS(_retval));
return CefTranslatorTestScopedClientCToCpp::UnwrapOwn(std::move(_retval));
}
int CEF_CALLBACK translator_test_set_child_own_ptr_client(
@@ -1328,7 +1328,7 @@ int CEF_CALLBACK translator_test_set_child_own_ptr_client(
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetChildOwnPtrClient(
OWN_PASS(valPtr));
std::move(valPtr));
// Return type: simple
return _retval;
@@ -1357,10 +1357,10 @@ translator_test_set_child_own_ptr_client_and_return_parent(
// Execute
CefOwnPtr<CefTranslatorTestScopedClient> _retval =
CefTranslatorTestCppToC::Get(self)->SetChildOwnPtrClientAndReturnParent(
OWN_PASS(valPtr));
std::move(valPtr));
// Return type: ownptr_diff
return CefTranslatorTestScopedClientCToCpp::UnwrapOwn(OWN_PASS(_retval));
return CefTranslatorTestScopedClientCToCpp::UnwrapOwn(std::move(_retval));
}
int CEF_CALLBACK translator_test_set_raw_ptr_library(

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=7fbfdb7d8fd3b7e41ba55f2138e9752f301a2438$
// $hash=fe3ba17a673de7d4051eb0ed4c83eb7d40f6d4b6$
//
#include "libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.h"
@@ -54,10 +54,8 @@ CefCppToCScoped<CefTranslatorTestScopedClientCppToC,
UnwrapDerivedOwn(CefWrapperType type,
cef_translator_test_scoped_client_t* s) {
if (type == WT_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD) {
return OWN_RETURN_AS(
CefTranslatorTestScopedClientChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_client_child_t*>(s)),
CefTranslatorTestScopedClient);
return CefTranslatorTestScopedClientChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_client_child_t*>(s));
}
NOTREACHED() << "Unexpected class type: " << type;
return CefOwnPtr<CefTranslatorTestScopedClient>();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=2f64a37b4735c7d91035aec2fffa263d7d27942b$
// $hash=1fa64c4f005a9ce3af83148fa5eeccaf45706200$
//
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.h"
@@ -29,7 +29,7 @@ cef_translator_test_scoped_library_child_child_create(int value,
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryChildChildCppToC::WrapOwn(
OWN_PASS(_retval));
std::move(_retval));
}
namespace {

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=cd7a42714195bed68aef8a200c7e1a38681558f2$
// $hash=a5c43bc178aa01efbf560be47b1429fd4540d27f$
//
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.h"
@@ -26,7 +26,7 @@ cef_translator_test_scoped_library_child_create(int value, int other_value) {
CefTranslatorTestScopedLibraryChild::Create(value, other_value);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryChildCppToC::WrapOwn(OWN_PASS(_retval));
return CefTranslatorTestScopedLibraryChildCppToC::WrapOwn(std::move(_retval));
}
namespace {
@@ -122,11 +122,8 @@ CefCppToCScoped<CefTranslatorTestScopedLibraryChildCppToC,
UnwrapDerivedOwn(CefWrapperType type,
cef_translator_test_scoped_library_child_t* s) {
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return OWN_RETURN_AS(
CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(
s)),
CefTranslatorTestScopedLibraryChild);
return CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(s));
}
NOTREACHED() << "Unexpected class type: " << type;
return CefOwnPtr<CefTranslatorTestScopedLibraryChild>();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=9e0c499cc30e7e762de3d5969ab6795ec50ffc08$
// $hash=4f28d789be1549022af70417a8d2f711d688f3b7$
//
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.h"
@@ -27,7 +27,7 @@ cef_translator_test_scoped_library_create(int value) {
CefTranslatorTestScopedLibrary::Create(value);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval));
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(std::move(_retval));
}
namespace {
@@ -83,17 +83,12 @@ CefCppToCScoped<CefTranslatorTestScopedLibraryCppToC,
UnwrapDerivedOwn(CefWrapperType type,
cef_translator_test_scoped_library_t* s) {
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD) {
return OWN_RETURN_AS(
CefTranslatorTestScopedLibraryChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_library_child_t*>(s)),
CefTranslatorTestScopedLibrary);
return CefTranslatorTestScopedLibraryChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_library_child_t*>(s));
}
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return OWN_RETURN_AS(
CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(
s)),
CefTranslatorTestScopedLibrary);
return CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(s));
}
NOTREACHED() << "Unexpected class type: " << type;
return CefOwnPtr<CefTranslatorTestScopedLibrary>();

View File

@@ -10,7 +10,6 @@
#include "include/base/cef_macros.h"
#include "include/capi/cef_base_capi.h"
#include "include/cef_base.h"
#include "libcef_dll/ptr_util.h"
#include "libcef_dll/wrapper_types.h"
// Wrap a C structure with a C++ class. This is used when the implementation
@@ -49,7 +48,7 @@ class CefCToCppScoped : public BaseName {
//
// void MyMethod(CefOwnPtr<MyType> obj) {
// // Ownership of the underlying MyType object is passed to my_method().
// my_method(MyTypeCToCpp::UnwrapOwn(obj.Pass()));
// my_method(MyTypeCToCpp::UnwrapOwn(std::move(obj)));
// // |obj| is now NULL.
// }
static StructName* UnwrapOwn(CefOwnPtr<BaseName> c);
@@ -129,7 +128,7 @@ StructName* CefCToCppScoped<ClassName, BaseName, StructName>::UnwrapOwn(
// If the type does not match this object then we need to unwrap as the
// derived type.
if (wrapperStruct->type_ != kWrapperType)
return UnwrapDerivedOwn(wrapperStruct->type_, OWN_PASS(c));
return UnwrapDerivedOwn(wrapperStruct->type_, std::move(c));
StructName* orig_struct = wrapperStruct->struct_;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=ff27c226ced0b2651b858eadea688d164dfa777e$
// $hash=210590ae794f6690729538f2e6ca59d264cb1dc9$
//
#include "libcef_dll/ctocpp/test/translator_test_ctocpp.h"
@@ -1161,7 +1161,7 @@ int CefTranslatorTestCToCpp::SetOwnPtrLibrary(
// Execute
int _retval = _struct->set_own_ptr_library(
_struct, CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(OWN_PASS(val)));
_struct, CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(std::move(val)));
// Return type: simple
return _retval;
@@ -1187,7 +1187,7 @@ CefOwnPtr<CefTranslatorTestScopedLibrary> CefTranslatorTestCToCpp::
cef_translator_test_scoped_library_t* _retval =
_struct->set_own_ptr_library_and_return(
_struct,
CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(OWN_PASS(val)));
CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(std::move(val)));
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCToCpp::Wrap(_retval);
@@ -1212,7 +1212,7 @@ int CefTranslatorTestCToCpp::SetChildOwnPtrLibrary(
// Execute
int _retval = _struct->set_child_own_ptr_library(
_struct,
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(OWN_PASS(val)));
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(std::move(val)));
// Return type: simple
return _retval;
@@ -1239,7 +1239,7 @@ CefOwnPtr<CefTranslatorTestScopedLibrary> CefTranslatorTestCToCpp::
cef_translator_test_scoped_library_t* _retval =
_struct->set_child_own_ptr_library_and_return_parent(
_struct,
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(OWN_PASS(val)));
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(std::move(val)));
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCToCpp::Wrap(_retval);
@@ -1263,7 +1263,7 @@ int CefTranslatorTestCToCpp::SetOwnPtrClient(
// Execute
int _retval = _struct->set_own_ptr_client(
_struct, CefTranslatorTestScopedClientCppToC::WrapOwn(OWN_PASS(val)));
_struct, CefTranslatorTestScopedClientCppToC::WrapOwn(std::move(val)));
// Return type: simple
return _retval;
@@ -1288,7 +1288,8 @@ CefOwnPtr<CefTranslatorTestScopedClient> CefTranslatorTestCToCpp::
// Execute
cef_translator_test_scoped_client_t* _retval =
_struct->set_own_ptr_client_and_return(
_struct, CefTranslatorTestScopedClientCppToC::WrapOwn(OWN_PASS(val)));
_struct,
CefTranslatorTestScopedClientCppToC::WrapOwn(std::move(val)));
// Return type: ownptr_diff
return CefTranslatorTestScopedClientCppToC::UnwrapOwn(_retval);
@@ -1313,7 +1314,7 @@ int CefTranslatorTestCToCpp::SetChildOwnPtrClient(
// Execute
int _retval = _struct->set_child_own_ptr_client(
_struct,
CefTranslatorTestScopedClientChildCppToC::WrapOwn(OWN_PASS(val)));
CefTranslatorTestScopedClientChildCppToC::WrapOwn(std::move(val)));
// Return type: simple
return _retval;
@@ -1340,7 +1341,7 @@ CefOwnPtr<CefTranslatorTestScopedClient> CefTranslatorTestCToCpp::
cef_translator_test_scoped_client_t* _retval =
_struct->set_child_own_ptr_client_and_return_parent(
_struct,
CefTranslatorTestScopedClientChildCppToC::WrapOwn(OWN_PASS(val)));
CefTranslatorTestScopedClientChildCppToC::WrapOwn(std::move(val)));
// Return type: ownptr_diff
return CefTranslatorTestScopedClientCppToC::UnwrapOwn(_retval);

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=bfa7d52202c1d09dfa86e05df4f60f3b9264e19c$
// $hash=3768f0baca452bd0aa50e298dcc2166efd11f3db$
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.h"
@@ -68,8 +68,7 @@ CefCToCppScoped<CefTranslatorTestScopedClientCToCpp,
return reinterpret_cast<cef_translator_test_scoped_client_t*>(
CefTranslatorTestScopedClientChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedClientChild>(
reinterpret_cast<CefTranslatorTestScopedClientChild*>(
CEF_RAW_PTR_GET(c)))));
reinterpret_cast<CefTranslatorTestScopedClientChild*>(c))));
}
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=3218861c702d3419a97a3a49b87898e1afc3d55e$
// $hash=e259f697e1edef88f12eae86d7161a4807438ef7$
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.h"
@@ -18,9 +18,8 @@
// STATIC METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
CefOwnPtr<
CefTranslatorTestScopedLibraryChild> CefTranslatorTestScopedLibraryChild::
Create(int value, int other_value) {
CefOwnPtr<CefTranslatorTestScopedLibraryChild>
CefTranslatorTestScopedLibraryChild::Create(int value, int other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
@@ -129,7 +128,7 @@ CefCToCppScoped<CefTranslatorTestScopedLibraryChildCToCpp,
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(
CEF_RAW_PTR_GET(c)))));
c))));
}
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=93bec9c1c78c75b71ca887b790977d027f197a79$
// $hash=589f29aab564ddcd4eaf69e116e2854a46b8048d$
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.h"
@@ -19,8 +19,8 @@
// STATIC METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
CefOwnPtr<CefTranslatorTestScopedLibrary> CefTranslatorTestScopedLibrary::
Create(int value) {
CefOwnPtr<CefTranslatorTestScopedLibrary>
CefTranslatorTestScopedLibrary::Create(int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
@@ -103,15 +103,14 @@ CefCToCppScoped<CefTranslatorTestScopedLibraryCToCpp,
return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChild*>(
CEF_RAW_PTR_GET(c)))));
reinterpret_cast<CefTranslatorTestScopedLibraryChild*>(c))));
}
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(
CEF_RAW_PTR_GET(c)))));
c))));
}
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;

View File

@@ -1,18 +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.
#ifndef CEF_LIBCEF_DLL_PTR_UTIL_H_
#define CEF_LIBCEF_DLL_PTR_UTIL_H_
#pragma once
// Helpers for CefOwnPtr<>.
#if defined(USING_CHROMIUM_INCLUDES)
#define OWN_PASS(p) std::move(p)
#define OWN_RETURN_AS(p, t) (p)
#else
#define OWN_PASS(p) (p).Pass()
#define OWN_RETURN_AS(p, t) (p).PassAs<t>()
#endif
#endif // CEF_LIBCEF_DLL_PTR_UTIL_H_

View File

@@ -4,13 +4,7 @@
#include "libcef_dll/shutdown_checker.h"
// For compatibility with older client compiler versions only use std::atomic
// on the library side.
#if defined(BUILDING_CEF_SHARED)
#include <atomic>
#else
#include "include/base/cef_atomic_ref_count.h"
#endif
#include "include/base/cef_logging.h"
@@ -20,8 +14,6 @@ namespace shutdown_checker {
namespace {
#if defined(BUILDING_CEF_SHARED)
std::atomic_bool g_cef_shutdown{false};
bool IsCefShutdown() {
@@ -32,20 +24,6 @@ void SetCefShutdown() {
g_cef_shutdown.store(true);
}
#else // !defined(BUILDING_CEF_SHARED)
base::AtomicRefCount g_cef_shutdown ATOMIC_DECLARATION;
bool IsCefShutdown() {
return !base::AtomicRefCountIsZero(&g_cef_shutdown);
}
void SetCefShutdown() {
base::AtomicRefCountInc(&g_cef_shutdown);
}
#endif // !defined(BUILDING_CEF_SHARED)
} // namespace
void AssertNotShutdown() {

View File

@@ -175,7 +175,7 @@ class ArchiveProvider : public CefResourceManager::Provider {
password_(password),
archive_load_started_(false),
archive_load_ended_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
weak_ptr_factory_(this) {
DCHECK(!url_path_.empty());
DCHECK(!archive_path_.empty());
@@ -306,7 +306,7 @@ struct CefResourceManager::ProviderEntry {
identifier_(identifier),
deletion_pending_(false) {}
scoped_ptr<Provider> provider_;
std::unique_ptr<Provider> provider_;
int order_;
std::string identifier_;
@@ -362,8 +362,8 @@ void CefResourceManager::Request::Stop() {
base::Passed(&state_)));
}
CefResourceManager::Request::Request(scoped_ptr<RequestState> state)
: state_(state.Pass()), params_(state_->params_) {
CefResourceManager::Request::Request(std::unique_ptr<RequestState> state)
: state_(std::move(state)), params_(state_->params_) {
CEF_REQUIRE_IO_THREAD();
ProviderEntry* entry = *(state_->current_entry_pos_);
@@ -379,13 +379,13 @@ CefResourceManager::Request::Request(scoped_ptr<RequestState> state)
// handle the request. Note that |state_| may already be NULL if OnRequest
// executes a callback before returning, in which case execution will continue
// asynchronously in any case.
scoped_ptr<CefResourceManager::RequestState>
std::unique_ptr<CefResourceManager::RequestState>
CefResourceManager::Request::SendRequest() {
CEF_REQUIRE_IO_THREAD();
Provider* provider = (*state_->current_entry_pos_)->provider_.get();
if (!provider->OnRequest(this))
return state_.Pass();
return scoped_ptr<RequestState>();
return std::move(state_);
return std::unique_ptr<RequestState>();
}
bool CefResourceManager::Request::HasState() {
@@ -395,23 +395,23 @@ bool CefResourceManager::Request::HasState() {
// static
void CefResourceManager::Request::ContinueOnIOThread(
scoped_ptr<RequestState> state,
std::unique_ptr<RequestState> state,
CefRefPtr<CefResourceHandler> handler) {
CEF_REQUIRE_IO_THREAD();
// The manager may already have been deleted.
base::WeakPtr<CefResourceManager> manager = state->manager_;
if (manager)
manager->ContinueRequest(state.Pass(), handler);
manager->ContinueRequest(std::move(state), handler);
}
// static
void CefResourceManager::Request::StopOnIOThread(
scoped_ptr<RequestState> state) {
std::unique_ptr<RequestState> state) {
CEF_REQUIRE_IO_THREAD();
// The manager may already have been deleted.
base::WeakPtr<CefResourceManager> manager = state->manager_;
if (manager)
manager->StopRequest(state.Pass());
manager->StopRequest(std::move(state));
}
// CefResourceManager implementation.
@@ -472,7 +472,7 @@ void CefResourceManager::AddProvider(Provider* provider,
return;
}
scoped_ptr<ProviderEntry> new_entry(
std::unique_ptr<ProviderEntry> new_entry(
new ProviderEntry(provider, order, identifier));
if (providers_.empty()) {
@@ -566,7 +566,7 @@ cef_return_value_t CefResourceManager::OnBeforeResourceLoad(
return RV_CONTINUE;
}
scoped_ptr<RequestState> state(new RequestState);
std::unique_ptr<RequestState> state(new RequestState);
if (!weak_ptr_factory_.get()) {
// WeakPtrFactory instances need to be created and destroyed on the same
@@ -590,7 +590,7 @@ cef_return_value_t CefResourceManager::OnBeforeResourceLoad(
state->current_entry_pos_ = current_entry_pos;
// If the request is potentially handled we need to continue asynchronously.
return SendRequest(state.Pass()) ? RV_CONTINUE_ASYNC : RV_CONTINUE;
return SendRequest(std::move(state)) ? RV_CONTINUE_ASYNC : RV_CONTINUE;
}
CefRefPtr<CefResourceHandler> CefResourceManager::GetResourceHandler(
@@ -616,13 +616,13 @@ CefRefPtr<CefResourceHandler> CefResourceManager::GetResourceHandler(
// Send the request to providers in order until one potentially handles it or we
// run out of providers. Returns true if the request is potentially handled.
bool CefResourceManager::SendRequest(scoped_ptr<RequestState> state) {
bool CefResourceManager::SendRequest(std::unique_ptr<RequestState> state) {
bool potentially_handled = false;
do {
// Should not be on the last provider entry.
DCHECK(state->current_entry_pos_ != providers_.end());
scoped_refptr<Request> request = new Request(state.Pass());
scoped_refptr<Request> request = new Request(std::move(state));
// Give the provider an opportunity to handle the request.
state = request->SendRequest();
@@ -630,7 +630,7 @@ bool CefResourceManager::SendRequest(scoped_ptr<RequestState> state) {
// The provider will not handle the request. Move to the next provider if
// any.
if (!IncrementProvider(state.get()))
StopRequest(state.Pass());
StopRequest(std::move(state));
} else {
potentially_handled = true;
}
@@ -640,7 +640,7 @@ bool CefResourceManager::SendRequest(scoped_ptr<RequestState> state) {
}
void CefResourceManager::ContinueRequest(
scoped_ptr<RequestState> state,
std::unique_ptr<RequestState> state,
CefRefPtr<CefResourceHandler> handler) {
CEF_REQUIRE_IO_THREAD();
@@ -648,17 +648,17 @@ void CefResourceManager::ContinueRequest(
// The request has been handled. Associate the request ID with the handler.
pending_handlers_.insert(
std::make_pair(state->params_.request_->GetIdentifier(), handler));
StopRequest(state.Pass());
StopRequest(std::move(state));
} else {
// Move to the next provider if any.
if (IncrementProvider(state.get()))
SendRequest(state.Pass());
SendRequest(std::move(state));
else
StopRequest(state.Pass());
StopRequest(std::move(state));
}
}
void CefResourceManager::StopRequest(scoped_ptr<RequestState> state) {
void CefResourceManager::StopRequest(std::unique_ptr<RequestState> state) {
CEF_REQUIRE_IO_THREAD();
// Detach from the current provider.

View File

@@ -5,10 +5,10 @@
#include "include/wrapper/cef_zip_archive.h"
#include <algorithm>
#include <memory>
#include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_scoped_ptr.h"
#include "include/cef_stream.h"
#include "include/cef_zip_reader.h"
#include "include/wrapper/cef_byte_read_handler.h"
@@ -56,7 +56,7 @@ class CefZipFile : public CefZipArchive::File {
private:
size_t data_size_;
scoped_ptr<unsigned char[]> data_;
std::unique_ptr<unsigned char[]> data_;
IMPLEMENT_REFCOUNTING(CefZipFile);
DISALLOW_COPY_AND_ASSIGN(CefZipFile);

View File

@@ -9,12 +9,13 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=9fbe1de9cf7f32c551c535e190d4c82b4947765d$
// $hash=85426bf2da9016443939636319265fff616f1cb4$
//
#include <dlfcn.h>
#include <stdio.h>
#include "include/base/cef_compiler_specific.h"
#include "include/capi/cef_app_capi.h"
#include "include/capi/cef_browser_capi.h"
#include "include/capi/cef_command_line_capi.h"