- Update to Chromium revision 133430.

- Move custom scheme registration to CefApp::OnRegisterCustomSchemes(). This is required by the introduction of ContentClient::AddAdditionalSchemes() and fixes a race condition when registering standard schemes in different processes.
- Execute V8 functions using V8Proxy. This is required for inspector instrumentation to work correctly and fixes an assertion in WebCore related to V8RecursionScope.
- Enable verbose V8 TryCatch logging.
- Mac: Expose UnderlayOpenGLHostingWindow interface that should be used for all CEF windows.
- Add CefSettings.remote_debugging_port option.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@602 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-04-24 18:01:48 +00:00
parent 97561ac51a
commit 6c8f4644aa
51 changed files with 758 additions and 546 deletions

View File

@@ -120,13 +120,6 @@ IPC_MESSAGE_ROUTED1(CefMsg_Response,
IPC_MESSAGE_ROUTED1(CefMsg_ResponseAck,
int /* request_id */)
// Sent to child processes to register a scheme.
IPC_MESSAGE_CONTROL4(CefProcessMsg_RegisterScheme,
std::string /* sheme_name */,
bool /* is_standard */,
bool /* is_local */,
bool /* is_display_isolated */)
// Sent to child processes to add or remove a cross-origin whitelist entry.
IPC_MESSAGE_CONTROL5(CefProcessMsg_ModifyCrossOriginWhitelistEntry,
bool /* add */,

View File

@@ -6,6 +6,7 @@
#include "include/cef_stream.h"
#include "include/cef_version.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/scheme_registrar_impl.h"
#include "base/command_line.h"
#include "base/logging.h"
@@ -42,6 +43,21 @@ void CefContentClient::AddNPAPIPlugins(
webkit::npapi::PluginList* plugin_list) {
}
void CefContentClient::AddAdditionalSchemes(
std::vector<std::string>* standard_schemes,
std::vector<std::string>* savable_schemes) {
if (application_.get()) {
CefRefPtr<CefSchemeRegistrarImpl> schemeRegistrar(
new CefSchemeRegistrarImpl());
application_->OnRegisterCustomSchemes(schemeRegistrar.get());
schemeRegistrar->GetStandardSchemes(standard_schemes);
// No references to the registar should be kept.
schemeRegistrar->Detach();
DCHECK(schemeRegistrar->VerifyRefCount());
}
}
bool CefContentClient::HasWebUIScheme(const GURL& url) const {
// There are no WebUI URLs in CEF.
return false;

View File

@@ -28,6 +28,9 @@ class CefContentClient : public content::ContentClient {
std::vector<content::PepperPluginInfo>* plugins) OVERRIDE;
virtual void AddNPAPIPlugins(
webkit::npapi::PluginList* plugin_list) OVERRIDE;
virtual void AddAdditionalSchemes(
std::vector<std::string>* standard_schemes,
std::vector<std::string>* savable_schemes) OVERRIDE;
virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE;
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
virtual std::string GetUserAgent() const OVERRIDE;

View File

@@ -15,6 +15,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/string_number_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "content/public/browser/browser_main_runner.h"
@@ -197,6 +198,12 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
}
}
if (settings.remote_debugging_port >= 1024 &&
settings.remote_debugging_port <= 65535) {
command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort,
base::IntToString(settings.remote_debugging_port));
}
// TODO(cef): Figure out how to support the sandbox.
if (!command_line->HasSwitch(switches::kNoSandbox))
command_line->AppendSwitch(switches::kNoSandbox);
@@ -211,6 +218,9 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
commandLinePtr->Detach(NULL);
}
content::SetContentClient(&content_client_);
InitializeContentClient(process_type);
return false;
}
@@ -220,12 +230,6 @@ void CefMainDelegate::PreSandboxStartup() {
#endif
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType);
content::SetContentClient(&content_client_);
InitializeContentClient(process_type);
if (command_line.HasSwitch(switches::kPackLoadingDisabled))
content_client_.set_pack_loading_disabled(true);
else
@@ -341,6 +345,8 @@ void CefMainDelegate::InitializeContentClient(
void CefMainDelegate::InitializeResourceBundle() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
// Mac OS-X does not support customization of the pack load paths.
#if !defined(OS_MACOSX)
FilePath pak_file, locales_dir;
if (command_line.HasSwitch(switches::kPackFilePath))
@@ -360,6 +366,7 @@ void CefMainDelegate::InitializeResourceBundle() {
if (!locales_dir.empty())
PathService::Override(ui::DIR_LOCALES, locales_dir);
#endif // !defined(OS_MACOSX)
std::string locale = command_line.GetSwitchValueASCII(switches::kLocale);
if (locale.empty())
@@ -372,7 +379,7 @@ void CefMainDelegate::InitializeResourceBundle() {
#if defined(OS_WIN)
// Explicitly load cef.pak on Windows.
if (file_util::PathExists(pak_file))
ResourceBundle::AddDataPackToSharedInstance(pak_file);
ResourceBundle::GetSharedInstance().AddDataPack(pak_file);
else
NOTREACHED() << "Could not load cef.pak";
#endif

View File

@@ -0,0 +1,67 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file.
#include "libcef/common/scheme_registrar_impl.h"
#include <string>
#include "libcef/renderer/content_renderer_client.h"
#include "base/bind.h"
#include "base/logging.h"
CefSchemeRegistrarImpl::CefSchemeRegistrarImpl()
: supported_thread_id_(base::PlatformThread::CurrentId()) {
}
bool CefSchemeRegistrarImpl::AddCustomScheme(
const CefString& scheme_name,
bool is_standard,
bool is_local,
bool is_display_isolated) {
if (!VerifyContext())
return false;
if (is_standard)
standard_schemes_.push_back(scheme_name);
if (CefContentRendererClient::Get()) {
// Register the custom scheme with WebKit.
CefContentRendererClient::Get()->AddCustomScheme(scheme_name, is_local,
is_display_isolated);
}
return true;
}
void CefSchemeRegistrarImpl::GetStandardSchemes(
std::vector<std::string>* standard_schemes) {
if (!VerifyContext())
return;
if (standard_schemes_.empty())
return;
standard_schemes->insert(standard_schemes->end(), standard_schemes_.begin(),
standard_schemes_.end());
}
bool CefSchemeRegistrarImpl::VerifyRefCount() {
return (GetRefCt() == 1);
}
void CefSchemeRegistrarImpl::Detach() {
if (VerifyContext())
supported_thread_id_ = base::kInvalidThreadId;
}
bool CefSchemeRegistrarImpl::VerifyContext() {
if (base::PlatformThread::CurrentId() != supported_thread_id_) {
// This object should only be accessed from the thread that created it.
NOTREACHED();
return false;
}
return true;
}

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2012 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_COMMON_SCHEME_REGISTRAR_IMPL_H_
#define CEF_LIBCEF_COMMON_SCHEME_REGISTRAR_IMPL_H_
#pragma once
#include <string>
#include <vector>
#include "include/cef_scheme.h"
#include "base/threading/platform_thread.h"
class CefSchemeRegistrarImpl : public CefSchemeRegistrar {
public:
CefSchemeRegistrarImpl();
// CefSchemeRegistrar methods.
virtual bool AddCustomScheme(const CefString& scheme_name,
bool is_standard,
bool is_local,
bool is_display_isolated) OVERRIDE;
void GetStandardSchemes(std::vector<std::string>* standard_schemes);
// Verify that only a single reference exists to all CefSchemeRegistrarImpl
// objects.
bool VerifyRefCount();
void Detach();
private:
// Verify that the object is being accessed from the correct thread.
bool VerifyContext();
base::PlatformThreadId supported_thread_id_;
std::vector<std::string> standard_schemes_;
IMPLEMENT_REFCOUNTING(CefSchemeRegistrarImpl);
DISALLOW_COPY_AND_ASSIGN(CefSchemeRegistrarImpl);
};
#endif // CEF_LIBCEF_COMMON_SCHEME_REGISTRAR_IMPL_H_