mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision c78c0ad7 (#363565)
This commit is contained in:
@@ -364,6 +364,7 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
|
||||
|
||||
url_request_getter_ = new CefURLRequestContextGetterImpl(
|
||||
settings_,
|
||||
GetPrefs(),
|
||||
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
|
||||
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
|
||||
protocol_handlers,
|
||||
|
@@ -209,7 +209,7 @@ class CefBrowserPlatformDelegate {
|
||||
|
||||
protected:
|
||||
// Allow deletion via scoped_ptr only.
|
||||
friend struct base::DefaultDeleter<CefBrowserPlatformDelegate>;
|
||||
friend std::default_delete<CefBrowserPlatformDelegate>;
|
||||
|
||||
CefBrowserPlatformDelegate();
|
||||
virtual ~CefBrowserPlatformDelegate();
|
||||
|
@@ -203,7 +203,8 @@ StatusTray* ChromeBrowserProcessStub::status_tray() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SafeBrowsingService* ChromeBrowserProcessStub::safe_browsing_service() {
|
||||
safe_browsing::SafeBrowsingService*
|
||||
ChromeBrowserProcessStub::safe_browsing_service() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
||||
void set_background_mode_manager_for_test(
|
||||
scoped_ptr<BackgroundModeManager> manager) override;
|
||||
StatusTray* status_tray() override;
|
||||
SafeBrowsingService* safe_browsing_service() override;
|
||||
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
|
||||
safe_browsing::ClientSideDetectionService*
|
||||
safe_browsing_detection_service() override;
|
||||
|
||||
|
@@ -594,7 +594,6 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
switches::kDisableScrollBounce,
|
||||
switches::kDisableSpellChecking,
|
||||
switches::kEnableSpeechInput,
|
||||
switches::kEnableSpellingAutoCorrect,
|
||||
switches::kEnableSystemFlash,
|
||||
switches::kPpapiFlashArgs,
|
||||
switches::kPpapiFlashPath,
|
||||
@@ -677,8 +676,7 @@ content::SpeechRecognitionManagerDelegate*
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::AllowCertificateError(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
content::WebContents* web_contents,
|
||||
int cert_error,
|
||||
const net::SSLInfo& ssl_info,
|
||||
const GURL& request_url,
|
||||
@@ -699,8 +697,7 @@ void CefContentBrowserClient::AllowCertificateError(
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForFrame(render_process_id,
|
||||
render_frame_id);
|
||||
CefBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||
if (!browser.get())
|
||||
return;
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
@@ -846,7 +843,8 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
|
||||
new navigation_interception::InterceptNavigationThrottle(
|
||||
navigation_handle,
|
||||
base::Bind(&NavigationOnUIThread, is_main_frame, frame_id,
|
||||
parent_frame_id));
|
||||
parent_frame_id),
|
||||
true);
|
||||
throttles.push_back(throttle);
|
||||
|
||||
return throttles.Pass();
|
||||
@@ -882,18 +880,14 @@ const wchar_t* CefContentBrowserClient::GetResourceDllName() {
|
||||
return file_path;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::PreSpawnRenderer(
|
||||
sandbox::TargetPolicy* policy,
|
||||
bool* success) {
|
||||
bool CefContentBrowserClient::PreSpawnRenderer(
|
||||
sandbox::TargetPolicy* policy) {
|
||||
// Flash requires this permission to play video files.
|
||||
sandbox::ResultCode result = policy->AddRule(
|
||||
sandbox::TargetPolicy::SUBSYS_HANDLES,
|
||||
sandbox::TargetPolicy::HANDLES_DUP_ANY,
|
||||
L"File");
|
||||
if (result != sandbox::SBOX_ALL_OK) {
|
||||
*success = false;
|
||||
return;
|
||||
}
|
||||
return result == sandbox::SBOX_ALL_OK;
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
|
@@ -65,8 +65,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::SpeechRecognitionManagerDelegate*
|
||||
CreateSpeechRecognitionManagerDelegate() override;
|
||||
void AllowCertificateError(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
content::WebContents* web_contents,
|
||||
int cert_error,
|
||||
const net::SSLInfo& ssl_info,
|
||||
const GURL& request_url,
|
||||
@@ -117,7 +116,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
|
||||
#if defined(OS_WIN)
|
||||
const wchar_t* GetResourceDllName() override;
|
||||
void PreSpawnRenderer(sandbox::TargetPolicy* policy, bool* success) override;
|
||||
bool PreSpawnRenderer(sandbox::TargetPolicy* policy) override;
|
||||
#endif
|
||||
|
||||
// Perform browser process registration for the custom scheme.
|
||||
|
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/net/network_delegate.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/time_util.h"
|
||||
|
||||
@@ -556,7 +557,8 @@ void CefCookieManagerImpl::SetCookieInternal(
|
||||
cookie.secure ? true : false,
|
||||
cookie.httponly ? true : false,
|
||||
false, // First-party only.
|
||||
false, // Enforces prefixes.
|
||||
CefNetworkDelegate::AreExperimentalCookieFeaturesEnabled(),
|
||||
CefNetworkDelegate::AreStrictSecureCookiesEnabled(),
|
||||
net::COOKIE_PRIORITY_DEFAULT,
|
||||
base::Bind(SetCookieCallbackImpl, callback));
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ class CefFileDialogRunner {
|
||||
|
||||
protected:
|
||||
// Allow deletion via scoped_ptr only.
|
||||
friend struct base::DefaultDeleter<CefFileDialogRunner>;
|
||||
friend std::default_delete<CefFileDialogRunner>;
|
||||
|
||||
CefFileDialogRunner() {}
|
||||
virtual ~CefFileDialogRunner() {}
|
||||
|
@@ -90,7 +90,7 @@ class CefFrameHostImpl : public CefFrame {
|
||||
int64 parent_frame_id_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefFrameHostImpl);
|
||||
DISALLOW_EVIL_CONSTRUCTORS(CefFrameHostImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefFrameHostImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_FRAME_HOST_IMPL_H_
|
||||
|
@@ -34,7 +34,7 @@ class CefJavaScriptDialogRunner {
|
||||
|
||||
protected:
|
||||
// Allow deletion via scoped_ptr only.
|
||||
friend struct base::DefaultDeleter<CefJavaScriptDialogRunner>;
|
||||
friend std::default_delete<CefJavaScriptDialogRunner>;
|
||||
|
||||
CefJavaScriptDialogRunner() {}
|
||||
virtual ~CefJavaScriptDialogRunner() {}
|
||||
|
@@ -29,7 +29,7 @@ class CefMenuRunner {
|
||||
|
||||
protected:
|
||||
// Allow deletion via scoped_ptr only.
|
||||
friend struct base::DefaultDeleter<CefMenuRunner>;
|
||||
friend std::default_delete<CefMenuRunner>;
|
||||
|
||||
CefMenuRunner() {}
|
||||
virtual ~CefMenuRunner() {}
|
||||
|
@@ -139,7 +139,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
// Likewise, the X server needs to know this window's pid so it knows which
|
||||
// program to kill if the window hangs.
|
||||
// XChangeProperty() expects "pid" to be long.
|
||||
COMPILE_ASSERT(sizeof(long) >= sizeof(pid_t), pid_t_bigger_than_long);
|
||||
static_assert(sizeof(long) >= sizeof(pid_t),
|
||||
"pid_t should not be larger than long");
|
||||
long pid = getpid();
|
||||
XChangeProperty(xdisplay_,
|
||||
xwindow_,
|
||||
|
@@ -14,6 +14,10 @@
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/response_impl.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/metrics/field_trial.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/filter/filter.h"
|
||||
#include "net/http/http_util.h"
|
||||
@@ -225,6 +229,27 @@ CefNetworkDelegate::CefNetworkDelegate() {
|
||||
CefNetworkDelegate::~CefNetworkDelegate() {
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefNetworkDelegate::AreExperimentalCookieFeaturesEnabled() {
|
||||
static bool initialized = false;
|
||||
static bool enabled = false;
|
||||
if (!initialized) {
|
||||
enabled = base::CommandLine::ForCurrentProcess()->
|
||||
HasSwitch(switches::kEnableExperimentalWebPlatformFeatures);
|
||||
initialized = true;
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefNetworkDelegate::AreStrictSecureCookiesEnabled() {
|
||||
const std::string enforce_strict_secure_group =
|
||||
base::FieldTrialList::FindFullName("StrictSecureCookies");
|
||||
return AreExperimentalCookieFeaturesEnabled() ||
|
||||
base::StartsWith(enforce_strict_secure_group, "Enabled",
|
||||
base::CompareCase::INSENSITIVE_ASCII);
|
||||
}
|
||||
|
||||
int CefNetworkDelegate::OnBeforeURLRequest(
|
||||
net::URLRequest* request,
|
||||
const net::CompletionCallback& callback,
|
||||
@@ -387,6 +412,14 @@ bool CefNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
|
||||
return AreExperimentalCookieFeaturesEnabled();
|
||||
}
|
||||
|
||||
bool CefNetworkDelegate::OnAreStrictSecureCookiesEnabled() const {
|
||||
return AreStrictSecureCookiesEnabled();
|
||||
}
|
||||
|
||||
net::Filter* CefNetworkDelegate::SetupFilter(net::URLRequest* request,
|
||||
net::Filter* filter_list) {
|
||||
CefRefPtr<CefResponseFilter> cef_filter;
|
||||
|
@@ -15,6 +15,11 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
||||
CefNetworkDelegate();
|
||||
~CefNetworkDelegate() override;
|
||||
|
||||
// Match the logic from ChromeNetworkDelegate and
|
||||
// RenderFrameMessageFilter::OnSetCookie.
|
||||
static bool AreExperimentalCookieFeaturesEnabled();
|
||||
static bool AreStrictSecureCookiesEnabled();
|
||||
|
||||
private:
|
||||
// net::NetworkDelegate methods.
|
||||
int OnBeforeURLRequest(net::URLRequest* request,
|
||||
@@ -28,6 +33,8 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
||||
void OnCompleted(net::URLRequest* request, bool started) override;
|
||||
bool OnCanAccessFile(const net::URLRequest& request,
|
||||
const base::FilePath& path) const override;
|
||||
bool OnAreExperimentalCookieFeaturesEnabled() const override;
|
||||
bool OnAreStrictSecureCookiesEnabled() const override;
|
||||
net::Filter* SetupFilter(net::URLRequest* request,
|
||||
net::Filter* filter_list) override;
|
||||
|
||||
|
@@ -106,25 +106,23 @@ class CefResourceRequestJobCallback : public CefCallback {
|
||||
if (job_->has_response_started() &&
|
||||
job_->GetStatus().is_io_pending()) {
|
||||
// Read the bytes. They should be available but, if not, wait again.
|
||||
int bytes_read = 0;
|
||||
if (job_->ReadRawData(dest_, dest_size_, &bytes_read)) {
|
||||
int bytes_read = job_->ReadRawData(dest_, dest_size_);
|
||||
if (bytes_read == net::ERR_IO_PENDING) {
|
||||
// Still pending, nothing to do...
|
||||
} else if (bytes_read >= 0) {
|
||||
// Must clear the members here because they may be reset as a result
|
||||
// of calling NotifyReadComplete.
|
||||
// of calling ReadRawDataComplete.
|
||||
dest_size_ = 0;
|
||||
dest_ = NULL;
|
||||
|
||||
// Clear the IO_PENDING status.
|
||||
job_->SetStatus(URLRequestStatus());
|
||||
|
||||
// Notify about the available bytes. If bytes_read > 0 then
|
||||
// ReadRawData may be called from URLRequest::Read. If bytes_read == 0
|
||||
// then Kill will be called from the URLRequest destructor.
|
||||
job_->NotifyReadComplete(bytes_read);
|
||||
} else if (!job_->GetStatus().is_io_pending()) {
|
||||
job_->ReadRawDataComplete(bytes_read);
|
||||
} else {
|
||||
// Failed due to an error.
|
||||
NOTREACHED() <<
|
||||
"ReadRawData returned false without setting IO as pending";
|
||||
job_->NotifyDone(URLRequestStatus());
|
||||
NOTREACHED() << "ReadRawData returned error " << bytes_read;
|
||||
job_->ReadRawDataComplete(bytes_read);
|
||||
Detach();
|
||||
}
|
||||
}
|
||||
@@ -220,28 +218,19 @@ void CefResourceRequestJob::Kill() {
|
||||
|
||||
// This method will be called by URLRequestJob::Read and our callback.
|
||||
// It can indicate the following states:
|
||||
// 1. If the request is complete set |bytes_read| == 0 and return true. The
|
||||
// caller is then responsible for calling NotifyReadComplete. ReadRawData
|
||||
// should not be called again.
|
||||
// 2. If data is available synchronously set |bytes_read| > 0 and return true.
|
||||
// The caller is then responsible for calling NotifyReadComplete. ReadRawData
|
||||
// may be called again by URLRequestJob::Read.
|
||||
// 3. If data is not available now but may be available asynchronously set
|
||||
// status to IO_PENDING and return false. When executed asynchronously the
|
||||
// callback will again call ReadRawData. If data is returned at that time the
|
||||
// callback will clear the status and call NotifyReadComplete.
|
||||
bool CefResourceRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size,
|
||||
int* bytes_read) {
|
||||
// 1. Return ERR_IO_PENDING, and call ReadRawDataComplete when the read
|
||||
// completes in any way, or
|
||||
// 2. Return a count of bytes read >= 0, indicating synchronous success, or
|
||||
// 3. Return another error code < 0, indicating synchronous failure.
|
||||
int CefResourceRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
DCHECK_NE(dest_size, 0);
|
||||
DCHECK(bytes_read);
|
||||
|
||||
if (remaining_bytes_ == 0) {
|
||||
// No more data to read.
|
||||
*bytes_read = 0;
|
||||
DoneWithRequest();
|
||||
return true;
|
||||
return 0;
|
||||
} else if (remaining_bytes_ > 0 && remaining_bytes_ < dest_size) {
|
||||
// The handler knows the content size beforehand.
|
||||
dest_size = static_cast<int>(remaining_bytes_);
|
||||
@@ -255,33 +244,31 @@ bool CefResourceRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size,
|
||||
}
|
||||
|
||||
// Read response data from the handler.
|
||||
bool rv = handler_->ReadResponse(dest->data(), dest_size, *bytes_read,
|
||||
int bytes_read = 0;
|
||||
bool rv = handler_->ReadResponse(dest->data(), dest_size, bytes_read,
|
||||
callback_.get());
|
||||
if (!rv) {
|
||||
// The handler has indicated completion of the request.
|
||||
*bytes_read = 0;
|
||||
DoneWithRequest();
|
||||
return true;
|
||||
} else if (*bytes_read == 0) {
|
||||
return 0;
|
||||
} else if (bytes_read == 0) {
|
||||
// Continue reading asynchronously. May happen multiple times in a row so
|
||||
// only set IO pending the first time.
|
||||
if (!GetStatus().is_io_pending()) {
|
||||
SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
|
||||
// only set destination members the first time.
|
||||
if (!GetStatus().is_io_pending())
|
||||
callback_->SetDestination(dest, dest_size);
|
||||
}
|
||||
return false;
|
||||
} else if (*bytes_read > dest_size) {
|
||||
return net::ERR_IO_PENDING;
|
||||
} else if (bytes_read > dest_size) {
|
||||
// Normalize the return value.
|
||||
*bytes_read = dest_size;
|
||||
bytes_read = dest_size;
|
||||
}
|
||||
|
||||
sent_bytes_ += *bytes_read;
|
||||
sent_bytes_ += bytes_read;
|
||||
|
||||
if (remaining_bytes_ > 0)
|
||||
remaining_bytes_ -= *bytes_read;
|
||||
remaining_bytes_ -= bytes_read;
|
||||
|
||||
// Continue calling this method.
|
||||
return true;
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
void CefResourceRequestJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
||||
|
@@ -33,7 +33,7 @@ class CefResourceRequestJob : public net::URLRequestJob {
|
||||
// net::URLRequestJob methods.
|
||||
void Start() override;
|
||||
void Kill() override;
|
||||
bool ReadRawData(net::IOBuffer* dest, int dest_size, int* bytes_read) override;
|
||||
int ReadRawData(net::IOBuffer* dest, int dest_size) override;
|
||||
void GetResponseInfo(net::HttpResponseInfo* info) override;
|
||||
void GetLoadTimingInfo(
|
||||
net::LoadTimingInfo* load_timing_info) const override;
|
||||
|
@@ -21,11 +21,13 @@
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/prefs/pref_service.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "base/threading/worker_pool.h"
|
||||
#include "chrome/browser/net/proxy_service_factory.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/common/content_client.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
@@ -36,6 +38,7 @@
|
||||
#include "net/dns/host_resolver.h"
|
||||
#include "net/ftp/ftp_network_layer.h"
|
||||
#include "net/http/http_auth_handler_factory.h"
|
||||
#include "net/http/http_auth_preferences.h"
|
||||
#include "net/http/http_cache.h"
|
||||
#include "net/http/http_server_properties_impl.h"
|
||||
#include "net/http/http_util.h"
|
||||
@@ -97,6 +100,7 @@ class CefHttpUserAgentSettings : public net::HttpUserAgentSettings {
|
||||
|
||||
CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
||||
const CefRequestContextSettings& settings,
|
||||
PrefService* pref_service,
|
||||
base::MessageLoop* io_loop,
|
||||
base::MessageLoop* file_loop,
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
@@ -111,6 +115,10 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
std::swap(protocol_handlers_, *protocol_handlers);
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||
gsapi_library_name_ = pref_service->GetString(prefs::kGSSAPILibraryName);
|
||||
#endif
|
||||
}
|
||||
|
||||
CefURLRequestContextGetterImpl::~CefURLRequestContextGetterImpl() {
|
||||
@@ -172,24 +180,23 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
|
||||
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
|
||||
|
||||
// Add support for single sign-on.
|
||||
url_security_manager_.reset(net::URLSecurityManager::Create(NULL, NULL));
|
||||
|
||||
std::vector<std::string> supported_schemes;
|
||||
supported_schemes.push_back("basic");
|
||||
supported_schemes.push_back("digest");
|
||||
supported_schemes.push_back("ntlm");
|
||||
supported_schemes.push_back("negotiate");
|
||||
|
||||
storage_->set_http_auth_handler_factory(make_scoped_ptr(
|
||||
http_auth_preferences_.reset(
|
||||
new net::HttpAuthPreferences(supported_schemes
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||
, gsapi_library_name_
|
||||
#endif
|
||||
));
|
||||
|
||||
storage_->set_http_auth_handler_factory(
|
||||
net::HttpAuthHandlerRegistryFactory::Create(
|
||||
supported_schemes,
|
||||
url_security_manager_.get(),
|
||||
url_request_context_->host_resolver(),
|
||||
std::string(),
|
||||
std::string(),
|
||||
false,
|
||||
false)));
|
||||
http_auth_preferences_.get(),
|
||||
url_request_context_->host_resolver()));
|
||||
storage_->set_http_server_properties(
|
||||
make_scoped_ptr<net::HttpServerProperties>(
|
||||
new net::HttpServerPropertiesImpl));
|
||||
|
@@ -21,6 +21,8 @@
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "net/url_request/url_request_job_factory.h"
|
||||
|
||||
class PrefService;
|
||||
|
||||
namespace base {
|
||||
class MessageLoop;
|
||||
}
|
||||
@@ -28,11 +30,11 @@ class MessageLoop;
|
||||
namespace net {
|
||||
class CookieMonster;
|
||||
class FtpTransactionFactory;
|
||||
class HttpAuthPreferences;
|
||||
class ProxyConfigService;
|
||||
class URLRequestContextStorage;
|
||||
class URLRequestJobFactory;
|
||||
class URLRequestJobFactoryImpl;
|
||||
class URLSecurityManager;
|
||||
}
|
||||
|
||||
// Isolated URLRequestContextGetter implementation. Life span is primarily
|
||||
@@ -43,6 +45,7 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
||||
public:
|
||||
CefURLRequestContextGetterImpl(
|
||||
const CefRequestContextSettings& settings,
|
||||
PrefService* pref_service,
|
||||
base::MessageLoop* io_loop,
|
||||
base::MessageLoop* file_loop,
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
@@ -80,11 +83,15 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
||||
base::MessageLoop* io_loop_;
|
||||
base::MessageLoop* file_loop_;
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||
std::string gsapi_library_name_;
|
||||
#endif
|
||||
|
||||
scoped_ptr<net::ProxyConfigService> proxy_config_service_;
|
||||
scoped_ptr<net::URLRequestContextStorage> storage_;
|
||||
scoped_ptr<net::HttpAuthPreferences> http_auth_preferences_;
|
||||
scoped_ptr<CefURLRequestContextImpl> url_request_context_;
|
||||
scoped_ptr<CefURLRequestManager> url_request_manager_;
|
||||
scoped_ptr<net::URLSecurityManager> url_security_manager_;
|
||||
scoped_ptr<net::FtpTransactionFactory> ftp_transaction_factory_;
|
||||
content::ProtocolHandlerMap protocol_handlers_;
|
||||
content::URLRequestInterceptorScopedVector request_interceptors_;
|
||||
|
@@ -147,7 +147,7 @@ class CefOriginWhitelistManager {
|
||||
typedef std::vector<Cef_CrossOriginWhiteListEntry_Params> OriginList;
|
||||
OriginList origin_list_;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(CefOriginWhitelistManager);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefOriginWhitelistManager);
|
||||
};
|
||||
|
||||
base::LazyInstance<CefOriginWhitelistManager> g_manager =
|
||||
|
@@ -293,7 +293,7 @@ class CefCopyFrameGenerator {
|
||||
content::GLHelper* gl_helper =
|
||||
content::ImageTransportFactory::GetInstance()->GetGLHelper();
|
||||
if (gl_helper)
|
||||
sync_token = gpu::SyncToken(gl_helper->InsertSyncPoint());
|
||||
gl_helper->GenerateSyncToken(&sync_token);
|
||||
}
|
||||
const bool lost_resource = !sync_token.HasData();
|
||||
release_callback->Run(sync_token, lost_resource);
|
||||
@@ -658,12 +658,8 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
|
||||
|
||||
// The compositor will draw directly to the SoftwareOutputDevice which
|
||||
// then calls OnPaint.
|
||||
delegated_frame_host_->SwapDelegatedFrame(
|
||||
output_surface_id,
|
||||
frame->delegated_frame_data.Pass(),
|
||||
frame->metadata.device_scale_factor,
|
||||
frame->metadata.latency_info,
|
||||
&frame->metadata.satisfies_sequences);
|
||||
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
||||
frame.Pass());
|
||||
} else {
|
||||
if (!copy_frame_generator_.get()) {
|
||||
copy_frame_generator_.reset(
|
||||
@@ -673,18 +669,14 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
|
||||
// Determine the damage rectangle for the current frame. This is the same
|
||||
// calculation that SwapDelegatedFrame uses.
|
||||
cc::RenderPass* root_pass =
|
||||
frame->delegated_frame_data->render_pass_list.back();
|
||||
frame->delegated_frame_data->render_pass_list.back().get();
|
||||
gfx::Size frame_size = root_pass->output_rect.size();
|
||||
gfx::Rect damage_rect =
|
||||
gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect));
|
||||
damage_rect.Intersect(gfx::Rect(frame_size));
|
||||
|
||||
delegated_frame_host_->SwapDelegatedFrame(
|
||||
output_surface_id,
|
||||
frame->delegated_frame_data.Pass(),
|
||||
frame->metadata.device_scale_factor,
|
||||
frame->metadata.latency_info,
|
||||
&frame->metadata.satisfies_sequences);
|
||||
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
||||
frame.Pass());
|
||||
|
||||
// Request a copy of the last compositor frame which will eventually call
|
||||
// OnPaint asynchronously.
|
||||
@@ -866,7 +858,7 @@ void CefRenderWidgetHostViewOSR::CopyFromCompositingSurface(
|
||||
void CefRenderWidgetHostViewOSR::CopyFromCompositingSurfaceToVideoFrame(
|
||||
const gfx::Rect& src_subrect,
|
||||
const scoped_refptr<media::VideoFrame>& target,
|
||||
const base::Callback<void(bool)>& callback) {
|
||||
const base::Callback<void(const gfx::Rect&, bool)>& callback) {
|
||||
delegated_frame_host_->CopyFromCompositingSurfaceToVideoFrame(
|
||||
src_subrect, target, callback);
|
||||
}
|
||||
|
@@ -159,7 +159,7 @@ class CefRenderWidgetHostViewOSR
|
||||
void CopyFromCompositingSurfaceToVideoFrame(
|
||||
const gfx::Rect& src_subrect,
|
||||
const scoped_refptr<media::VideoFrame>& target,
|
||||
const base::Callback<void(bool)>& callback) override;
|
||||
const base::Callback<void(const gfx::Rect&, bool)>& callback) override;
|
||||
bool CanCopyToVideoFrame() const override;
|
||||
void BeginFrameSubscription(
|
||||
scoped_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber)
|
||||
|
@@ -147,10 +147,6 @@ scoped_ptr<PrefService> CreatePrefService(const base::FilePath& pref_path) {
|
||||
registry->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService,
|
||||
command_line->HasSwitch(switches::kEnableSpellingService));
|
||||
registry->RegisterBooleanPref(prefs::kEnableContinuousSpellcheck, true);
|
||||
// The kEnableSpellingAutoCorrect command-line value is also checked in
|
||||
// SpellCheckProvider::autoCorrectWord.
|
||||
registry->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect,
|
||||
command_line->HasSwitch(switches::kEnableSpellingAutoCorrect));
|
||||
|
||||
// Pepper flash preferences.
|
||||
// Based on DeviceIDFetcher::RegisterProfilePrefs.
|
||||
@@ -162,6 +158,12 @@ scoped_ptr<PrefService> CreatePrefService(const base::FilePath& pref_path) {
|
||||
registry->RegisterBooleanPref(prefs::kPluginsAllowOutdated, false);
|
||||
registry->RegisterBooleanPref(prefs::kPluginsAlwaysAuthorize, false);
|
||||
|
||||
// Network preferences.
|
||||
// Based on IOThread::RegisterPrefs.
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||
registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string());
|
||||
#endif
|
||||
|
||||
if (command_line->HasSwitch(switches::kEnablePreferenceTesting)) {
|
||||
// Preferences used with unit tests.
|
||||
registry->RegisterBooleanPref("test.bool", true);
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "content/public/browser/site_instance.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/web_preferences.h"
|
||||
#include "content/public/common/webrtc_ip_handling_policy.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "extensions/browser/view_type_utils.h"
|
||||
#include "extensions/common/constants.h"
|
||||
@@ -58,11 +59,6 @@ void SetDefaultPrefs(content::WebPreferences& web) {
|
||||
command_line->HasSwitch(switches::kImageShrinkStandaloneToFit);
|
||||
web.text_areas_are_resizable =
|
||||
!command_line->HasSwitch(switches::kDisableTextAreaResize);
|
||||
|
||||
web.asynchronous_spell_checking_enabled = true;
|
||||
// Auto-correct does not work in combination with the unified text checker.
|
||||
web.unified_textchecker_enabled =
|
||||
!command_line->HasSwitch(switches::kEnableSpellingAutoCorrect);
|
||||
}
|
||||
|
||||
// Chrome preferences.
|
||||
@@ -346,10 +342,15 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
|
||||
prefs::kEnableDoNotTrack,
|
||||
false,
|
||||
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
||||
|
||||
#if defined(ENABLE_WEBRTC)
|
||||
// TODO(guoweis): Remove next 2 options at M50.
|
||||
registry->RegisterBooleanPref(prefs::kWebRTCMultipleRoutesEnabled, true);
|
||||
registry->RegisterBooleanPref(prefs::kWebRTCNonProxiedUdpEnabled, true);
|
||||
registry->RegisterStringPref(prefs::kWebRTCIPHandlingPolicy,
|
||||
content::kWebRTCIPHandlingDefault);
|
||||
#endif
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
registry->RegisterBooleanPref(prefs::kFullscreenAllowed, true);
|
||||
#endif
|
||||
|
@@ -37,7 +37,7 @@ CefTraceSubscriber::CefTraceSubscriber()
|
||||
CefTraceSubscriber::~CefTraceSubscriber() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (collecting_trace_data_)
|
||||
TracingController::GetInstance()->DisableRecording(NULL);
|
||||
TracingController::GetInstance()->StopTracing(NULL);
|
||||
}
|
||||
|
||||
bool CefTraceSubscriber::BeginTracing(
|
||||
@@ -50,13 +50,13 @@ bool CefTraceSubscriber::BeginTracing(
|
||||
|
||||
collecting_trace_data_ = true;
|
||||
|
||||
TracingController::EnableRecordingDoneCallback done_callback;
|
||||
TracingController::StartTracingDoneCallback done_callback;
|
||||
if (callback.get()) {
|
||||
done_callback =
|
||||
base::Bind(&CefCompletionCallback::OnComplete, callback.get());
|
||||
}
|
||||
|
||||
TracingController::GetInstance()->EnableRecording(
|
||||
TracingController::GetInstance()->StartTracing(
|
||||
base::trace_event::TraceConfig(categories, ""),
|
||||
done_callback);
|
||||
return true;
|
||||
@@ -73,7 +73,7 @@ bool CefTraceSubscriber::EndTracing(
|
||||
if (!callback.get()) {
|
||||
// Discard the trace data.
|
||||
collecting_trace_data_ = false;
|
||||
TracingController::GetInstance()->DisableRecording(NULL);
|
||||
TracingController::GetInstance()->StopTracing(NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ bool CefTraceSubscriber::EndTracing(
|
||||
base::Bind(&CefTraceSubscriber::OnTracingFileResult,
|
||||
weak_factory_.GetWeakPtr(), callback, tracing_file);
|
||||
|
||||
TracingController::GetInstance()->DisableRecording(
|
||||
TracingController::GetInstance()->StopTracing(
|
||||
TracingController::CreateFileSink(tracing_file, result_callback));
|
||||
return true;
|
||||
}
|
||||
|
@@ -213,6 +213,9 @@ void SetHeaderMap(const CefRequest::HeaderMap& map,
|
||||
}
|
||||
}
|
||||
|
||||
// Type used in UploadDataStream.
|
||||
typedef std::vector<scoped_ptr<net::UploadElementReader>> UploadElementReaders;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -983,11 +986,9 @@ void CefPostDataImpl::Set(const net::UploadDataStream& data_stream) {
|
||||
|
||||
CefRefPtr<CefPostDataElement> postelem;
|
||||
|
||||
const ScopedVector<net::UploadElementReader>* elements =
|
||||
data_stream.GetElementReaders();
|
||||
const UploadElementReaders* elements = data_stream.GetElementReaders();
|
||||
if (elements) {
|
||||
ScopedVector<net::UploadElementReader>::const_iterator it =
|
||||
elements->begin();
|
||||
UploadElementReaders::const_iterator it = elements->begin();
|
||||
for (; it != elements->end(); ++it) {
|
||||
postelem = CefPostDataElement::Create();
|
||||
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(**it);
|
||||
@@ -1015,14 +1016,14 @@ void CefPostDataImpl::Get(net::UploadData& data) const {
|
||||
net::UploadDataStream* CefPostDataImpl::Get() const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
ScopedVector<net::UploadElementReader> element_readers;
|
||||
UploadElementReaders element_readers;
|
||||
ElementVector::const_iterator it = elements_.begin();
|
||||
for (; it != elements_.end(); ++it) {
|
||||
element_readers.push_back(
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->Get());
|
||||
element_readers.push_back(make_scoped_ptr(
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->Get()));
|
||||
}
|
||||
|
||||
return new net::ElementsUploadDataStream(element_readers.Pass(), 0);
|
||||
return new net::ElementsUploadDataStream(std::move(element_readers), 0);
|
||||
}
|
||||
|
||||
void CefPostDataImpl::Set(const blink::WebHTTPBody& data) {
|
||||
|
@@ -63,6 +63,7 @@
|
||||
#include "extensions/renderer/renderer_extension_registry.h"
|
||||
#include "ipc/ipc_sync_channel.h"
|
||||
#include "media/base/media.h"
|
||||
#include "printing/print_settings.h"
|
||||
#include "third_party/WebKit/public/platform/WebPrerenderingSupport.h"
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/platform/WebURL.h"
|
||||
@@ -175,6 +176,9 @@ CefContentRendererClient::CefContentRendererClient()
|
||||
extensions::ExtensionsRendererClient::Set(
|
||||
extensions_renderer_client_.get());
|
||||
}
|
||||
#if defined(ENABLE_PRINTING)
|
||||
printing::SetAgent(CefContentClient::Get()->GetUserAgent());
|
||||
#endif
|
||||
}
|
||||
|
||||
CefContentRendererClient::~CefContentRendererClient() {
|
||||
|
@@ -64,7 +64,7 @@ class CefFrameImpl : public CefFrame {
|
||||
int64 frame_id_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefFrameImpl);
|
||||
DISALLOW_EVIL_CONSTRUCTORS(CefFrameImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefFrameImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_RENDERER_FRAME_IMPL_H_
|
||||
|
@@ -49,7 +49,7 @@ bool CefRenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
||||
}
|
||||
|
||||
void CefRenderMessageFilter::OnDevToolsAgentAttach(
|
||||
const std::string& host_id) {
|
||||
const std::string& host_id, int session_id) {
|
||||
CEF_POST_TASK_RT(
|
||||
base::Bind(&CefRenderMessageFilter::OnDevToolsAgentAttach_RT, this));
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ class CefRenderMessageFilter : public IPC::MessageFilter {
|
||||
|
||||
private:
|
||||
// Message handlers called on the IO thread.
|
||||
void OnDevToolsAgentAttach(const std::string& host_id);
|
||||
void OnDevToolsAgentAttach(const std::string& host_id, int session_id);
|
||||
void OnDevToolsAgentDetach(int32 routing_id);
|
||||
|
||||
void OnDevToolsAgentAttach_RT();
|
||||
|
@@ -51,6 +51,45 @@ static const char kCefContextState[] = "Cef::ContextState";
|
||||
void MessageListenerCallbackImpl(v8::Handle<v8::Message> message,
|
||||
v8::Handle<v8::Value> data);
|
||||
|
||||
// The following *Private functions are convenience wrappers for methods on
|
||||
// v8::Object with the corresponding names.
|
||||
// Based on extensions/renderer/object_backed_native_handler.cc.
|
||||
|
||||
void SetPrivate(v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Object> obj,
|
||||
const char* key,
|
||||
v8::Local<v8::Value> value) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
obj->SetPrivate(context,
|
||||
v8::Private::ForApi(isolate,
|
||||
v8::String::NewFromUtf8(isolate, key)),
|
||||
value)
|
||||
.FromJust();
|
||||
}
|
||||
|
||||
bool GetPrivate(v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Object> obj,
|
||||
const char* key,
|
||||
v8::Local<v8::Value>* result) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
return obj->GetPrivate(context,
|
||||
v8::Private::ForApi(
|
||||
isolate,
|
||||
v8::String::NewFromUtf8(isolate, key)))
|
||||
.ToLocal(result);
|
||||
}
|
||||
|
||||
void DeletePrivate(v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Object> obj,
|
||||
const char* key) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
obj->DeletePrivate(context,
|
||||
v8::Private::ForApi(
|
||||
isolate,
|
||||
v8::String::NewFromUtf8(isolate, key)))
|
||||
.FromJust();
|
||||
}
|
||||
|
||||
// Manages memory and state information associated with a single Isolate.
|
||||
class CefV8IsolateManager {
|
||||
public:
|
||||
@@ -108,18 +147,17 @@ class CefV8IsolateManager {
|
||||
|
||||
return state;
|
||||
} else {
|
||||
v8::Local<v8::String> key =
|
||||
v8::String::NewFromUtf8(isolate_, kCefContextState);
|
||||
|
||||
v8::Local<v8::Object> object = context->Global();
|
||||
v8::Local<v8::Value> value = object->GetHiddenValue(key);
|
||||
if (!value.IsEmpty()) {
|
||||
|
||||
v8::Local<v8::Value> value;
|
||||
if (GetPrivate(context, object, kCefContextState, &value)) {
|
||||
return static_cast<CefV8ContextState*>(
|
||||
v8::External::Cast(*value)->Value());
|
||||
}
|
||||
|
||||
scoped_refptr<CefV8ContextState> state = new CefV8ContextState();
|
||||
object->SetHiddenValue(key, v8::External::New(isolate_, state.get()));
|
||||
SetPrivate(context, object, kCefContextState,
|
||||
v8::External::New(isolate_, state.get()));
|
||||
|
||||
// Reference will be released in ReleaseContext.
|
||||
state->AddRef();
|
||||
@@ -143,20 +181,19 @@ class CefV8IsolateManager {
|
||||
context_map_.erase(it);
|
||||
}
|
||||
} else {
|
||||
v8::Local<v8::String> key =
|
||||
v8::String::NewFromUtf8(isolate_, kCefContextState);
|
||||
v8::Local<v8::Object> object = context->Global();
|
||||
v8::Local<v8::Value> value = object->GetHiddenValue(key);
|
||||
if (value.IsEmpty())
|
||||
return;
|
||||
|
||||
scoped_refptr<CefV8ContextState> state =
|
||||
static_cast<CefV8ContextState*>(v8::External::Cast(*value)->Value());
|
||||
state->Detach();
|
||||
object->DeleteHiddenValue(key);
|
||||
v8::Local<v8::Value> value;
|
||||
if (GetPrivate(context, object, kCefContextState, &value)) {
|
||||
scoped_refptr<CefV8ContextState> state =
|
||||
static_cast<CefV8ContextState*>(
|
||||
v8::External::Cast(*value)->Value());
|
||||
state->Detach();
|
||||
DeletePrivate(context, object, kCefContextState);
|
||||
|
||||
// Match the AddRef in GetContextState.
|
||||
state->Release();
|
||||
// Match the AddRef in GetContextState.
|
||||
state->Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,19 +360,17 @@ class V8TrackObject : public CefTrackNode {
|
||||
}
|
||||
|
||||
// Attach this track object to the specified V8 object.
|
||||
void AttachTo(v8::Local<v8::Object> object) {
|
||||
object->SetHiddenValue(v8::String::NewFromUtf8(isolate_, kCefTrackObject),
|
||||
v8::External::New(isolate_, this));
|
||||
void AttachTo(v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Object> object) {
|
||||
SetPrivate(context, object, kCefTrackObject,
|
||||
v8::External::New(isolate_, this));
|
||||
}
|
||||
|
||||
// Retrieve the track object for the specified V8 object.
|
||||
static V8TrackObject* Unwrap(v8::Isolate* isolate,
|
||||
static V8TrackObject* Unwrap(v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Object> object) {
|
||||
DCHECK(isolate);
|
||||
v8::Local<v8::Value> value =
|
||||
object->GetHiddenValue(
|
||||
v8::String::NewFromUtf8(isolate, kCefTrackObject));
|
||||
if (!value.IsEmpty())
|
||||
v8::Local<v8::Value> value;
|
||||
if (GetPrivate(context, object, kCefTrackObject, &value))
|
||||
return static_cast<V8TrackObject*>(v8::External::Cast(*value)->Value());
|
||||
|
||||
return NULL;
|
||||
@@ -480,12 +515,13 @@ void AccessorGetterCallbackImpl(
|
||||
v8::Local<v8::String> property,
|
||||
const v8::PropertyCallbackInfo<v8::Value>& info) {
|
||||
v8::Isolate* isolate = info.GetIsolate();
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
|
||||
v8::Local<v8::Object> obj = info.This();
|
||||
|
||||
CefRefPtr<CefV8Accessor> accessorPtr;
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
accessorPtr = tracker->GetAccessor();
|
||||
|
||||
@@ -518,12 +554,13 @@ void AccessorSetterCallbackImpl(
|
||||
v8::Local<v8::Value> value,
|
||||
const v8::PropertyCallbackInfo<void>& info) {
|
||||
v8::Isolate* isolate = info.GetIsolate();
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
|
||||
v8::Local<v8::Object> obj = info.This();
|
||||
|
||||
CefRefPtr<CefV8Accessor> accessorPtr;
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
accessorPtr = tracker->GetAccessor();
|
||||
|
||||
@@ -947,7 +984,7 @@ bool CefV8ContextImpl::Eval(const CefString& code,
|
||||
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(val);
|
||||
v8::Local<v8::Value> code_val = GetV8String(isolate, code);
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
|
||||
retval = NULL;
|
||||
@@ -1172,7 +1209,7 @@ CefRefPtr<CefV8Value> CefV8Value::CreateObject(
|
||||
tracker->SetAccessor(accessor);
|
||||
|
||||
// Attach the tracker object.
|
||||
tracker->AttachTo(obj);
|
||||
tracker->AttachTo(context, obj);
|
||||
|
||||
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
|
||||
impl->InitObject(obj, tracker);
|
||||
@@ -1200,7 +1237,7 @@ CefRefPtr<CefV8Value> CefV8Value::CreateArray(int length) {
|
||||
v8::Local<v8::Array> arr = v8::Array::New(isolate, length);
|
||||
|
||||
// Attach the tracker object.
|
||||
tracker->AttachTo(arr);
|
||||
tracker->AttachTo(context, arr);
|
||||
|
||||
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
|
||||
impl->InitObject(arr, tracker);
|
||||
@@ -1250,7 +1287,7 @@ CefRefPtr<CefV8Value> CefV8Value::CreateFunction(
|
||||
tracker->SetHandler(handler);
|
||||
|
||||
// Attach the tracker object.
|
||||
tracker->AttachTo(func);
|
||||
tracker->AttachTo(context, func);
|
||||
|
||||
// Create the CefV8ValueImpl and provide a tracker object that will cause
|
||||
// the handler reference to be released when the V8 object is destroyed.
|
||||
@@ -1567,10 +1604,17 @@ bool CefV8ValueImpl::IsUserCreated() {
|
||||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
return (tracker != NULL);
|
||||
}
|
||||
|
||||
@@ -1638,7 +1682,7 @@ bool CefV8ValueImpl::DeleteValue(const CefString& key) {
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
bool del = obj->Delete(GetV8String(isolate, key));
|
||||
return (!HasCaught(try_catch) && del);
|
||||
@@ -1652,11 +1696,12 @@ bool CefV8ValueImpl::DeleteValue(int index) {
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::HandleScope handle_scope(handle_->isolate());
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
bool del = obj->Delete(index);
|
||||
return (!HasCaught(try_catch) && del);
|
||||
@@ -1670,7 +1715,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(const CefString& key) {
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
v8::Local<v8::Value> ret_value = obj->Get(GetV8String(isolate, key));
|
||||
if (!HasCaught(try_catch) && !ret_value.IsEmpty())
|
||||
@@ -1691,7 +1736,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(int index) {
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
v8::Local<v8::Value> ret_value = obj->Get(v8::Number::New(isolate, index));
|
||||
if (!HasCaught(try_catch) && !ret_value.IsEmpty())
|
||||
@@ -1711,7 +1756,7 @@ bool CefV8ValueImpl::SetValue(const CefString& key,
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
bool set;
|
||||
// TODO(cef): This usage may not exactly match the previous implementation.
|
||||
@@ -1741,11 +1786,12 @@ bool CefV8ValueImpl::SetValue(int index, CefRefPtr<CefV8Value> value) {
|
||||
|
||||
CefV8ValueImpl* impl = static_cast<CefV8ValueImpl*>(value.get());
|
||||
if (impl && impl->IsValid()) {
|
||||
v8::HandleScope handle_scope(handle_->isolate());
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
bool set = obj->Set(index, impl->GetV8Value(true));
|
||||
return (!HasCaught(try_catch) && set);
|
||||
@@ -1761,12 +1807,19 @@ bool CefV8ValueImpl::SetValue(const CefString& key, AccessControl settings,
|
||||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
CefRefPtr<CefV8Accessor> accessorPtr;
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
accessorPtr = tracker->GetAccessor();
|
||||
|
||||
@@ -1779,7 +1832,7 @@ bool CefV8ValueImpl::SetValue(const CefString& key, AccessControl settings,
|
||||
(attribute & V8_PROPERTY_ATTRIBUTE_READONLY) ?
|
||||
NULL : AccessorSetterCallbackImpl;
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
bool set = obj->SetAccessor(GetV8String(isolate, key), getter, setter, obj,
|
||||
static_cast<v8::AccessControl>(settings),
|
||||
@@ -1811,10 +1864,17 @@ bool CefV8ValueImpl::SetUserData(CefRefPtr<CefBase> user_data) {
|
||||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker) {
|
||||
tracker->SetUserData(user_data);
|
||||
return true;
|
||||
@@ -1828,10 +1888,17 @@ CefRefPtr<CefBase> CefV8ValueImpl::GetUserData() {
|
||||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
return tracker->GetUserData();
|
||||
|
||||
@@ -1843,10 +1910,17 @@ int CefV8ValueImpl::GetExternallyAllocatedMemory() {
|
||||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return 0;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
return tracker->GetExternallyAllocatedMemory();
|
||||
|
||||
@@ -1858,10 +1932,17 @@ int CefV8ValueImpl::AdjustExternallyAllocatedMemory(int change_in_bytes) {
|
||||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return 0;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
return tracker->AdjustExternallyAllocatedMemory(change_in_bytes);
|
||||
|
||||
@@ -1905,14 +1986,21 @@ CefRefPtr<CefV8Handler> CefV8ValueImpl::GetFunctionHandler() {
|
||||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
if (!value->IsFunction()) {
|
||||
NOTREACHED() << "V8 value is not a function";
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
return tracker->GetHandler();
|
||||
|
||||
@@ -1995,7 +2083,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
|
||||
CefRefPtr<CefV8Value> retval;
|
||||
|
||||
{
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
|
||||
v8::MaybeLocal<v8::Value> func_rv =
|
||||
|
Reference in New Issue
Block a user