Update to Chromium revision 241258.

- Update tracing implementation to use the new file-based approach (issue #1157).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1549 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-12-17 22:04:35 +00:00
parent 992cc56583
commit 099664fba0
76 changed files with 1239 additions and 908 deletions

View File

@ -17,5 +17,5 @@
{
'chromium_url': 'http://src.chromium.org/svn/trunk/src',
'chromium_revision': '237081',
'chromium_revision': '241258',
}

View File

@ -174,6 +174,8 @@
'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/ctocpp/focus_handler_ctocpp.cc',
@ -244,8 +246,6 @@
'libcef_dll/ctocpp/task_ctocpp.h',
'libcef_dll/cpptoc/task_runner_cpptoc.cc',
'libcef_dll/cpptoc/task_runner_cpptoc.h',
'libcef_dll/ctocpp/trace_client_ctocpp.cc',
'libcef_dll/ctocpp/trace_client_ctocpp.h',
'libcef_dll/cpptoc/urlrequest_cpptoc.cc',
'libcef_dll/cpptoc/urlrequest_cpptoc.h',
'libcef_dll/ctocpp/urlrequest_client_ctocpp.cc',
@ -336,6 +336,8 @@
'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/cpptoc/focus_handler_cpptoc.cc',
@ -406,8 +408,6 @@
'libcef_dll/cpptoc/task_cpptoc.h',
'libcef_dll/ctocpp/task_runner_ctocpp.cc',
'libcef_dll/ctocpp/task_runner_ctocpp.h',
'libcef_dll/cpptoc/trace_client_cpptoc.cc',
'libcef_dll/cpptoc/trace_client_cpptoc.h',
'libcef_dll/ctocpp/urlrequest_ctocpp.cc',
'libcef_dll/ctocpp/urlrequest_ctocpp.h',
'libcef_dll/cpptoc/urlrequest_client_cpptoc.cc',

View File

@ -62,23 +62,7 @@ extern "C" {
//
// This function must be called on the browser process UI thread.
///
CEF_EXPORT int cef_begin_tracing(struct _cef_trace_client_t* client,
const cef_string_t* categories);
///
// Get the maximum trace buffer percent full state across all processes.
//
// cef_trace_client_t::OnTraceBufferPercentFullReply will be called
// asynchronously after the value is determined. When any child process reaches
// 100% full tracing will end automatically and
// cef_trace_client_t::OnEndTracingComplete will be called. This function fails
// and returns false (0) if trace is ending or disabled, no cef_trace_client_t
// was passed to CefBeginTracing, or if a previous call to
// CefGetTraceBufferPercentFullAsync is pending.
//
// This function must be called on the browser process UI thread.
///
CEF_EXPORT int cef_get_trace_buffer_percent_full_async();
CEF_EXPORT int cef_begin_tracing(const cef_string_t* categories);
///
// Stop tracing events on all processes.
@ -86,9 +70,15 @@ CEF_EXPORT int cef_get_trace_buffer_percent_full_async();
// This function will fail and return false (0) if a previous call to
// CefEndTracingAsync is already pending or if CefBeginTracing was not called.
//
// |tracing_file| is the path at which tracing data will be written and
// |callback| is the callback that will be executed once all processes have sent
// their trace data. If |tracing_file| is NULL a new temporary file path will be
// used. If |callback| is NULL no trace data will be written.
//
// This function must be called on the browser process UI thread.
///
CEF_EXPORT int cef_end_tracing_async();
CEF_EXPORT int cef_end_tracing_async(const cef_string_t* tracing_file,
struct _cef_end_tracing_callback_t* callback);
///
// Returns the current system trace time or, if none is defined, the current
@ -98,35 +88,25 @@ CEF_EXPORT int cef_end_tracing_async();
CEF_EXPORT int64 cef_now_from_system_trace_time();
///
// Implement this structure to receive trace notifications. The functions of
// this structure will be called on the browser process UI thread.
// Implement this structure to receive notification when tracing has completed.
// The functions of this structure will be called on the browser process UI
// thread.
///
typedef struct _cef_trace_client_t {
typedef struct _cef_end_tracing_callback_t {
///
// Base structure.
///
cef_base_t base;
///
// Called 0 or more times between CefBeginTracing and OnEndTracingComplete
// with a UTF8 JSON |fragment| of the specified |fragment_size|. Do not keep a
// reference to |fragment|.
///
void (CEF_CALLBACK *on_trace_data_collected)(struct _cef_trace_client_t* self,
const char* fragment, size_t fragment_size);
///
// Called in response to CefGetTraceBufferPercentFullAsync.
///
void (CEF_CALLBACK *on_trace_buffer_percent_full_reply)(
struct _cef_trace_client_t* self, float percent_full);
///
// Called after all processes have sent their trace data.
// Called after all processes have sent their trace data. |tracing_file| is
// the path at which tracing data was written. The client is responsible for
// deleting |tracing_file|.
///
void (CEF_CALLBACK *on_end_tracing_complete)(
struct _cef_trace_client_t* self);
} cef_trace_client_t;
struct _cef_end_tracing_callback_t* self,
const cef_string_t* tracing_file);
} cef_end_tracing_callback_t;
#ifdef __cplusplus

View File

@ -44,32 +44,19 @@
#include "include/cef_base.h"
///
// Implement this interface to receive trace notifications. The methods of this
// class will be called on the browser process UI thread.
// Implement this interface to receive notification when tracing has completed.
// The methods of this class will be called on the browser process UI thread.
///
/*--cef(source=client)--*/
class CefTraceClient : public virtual CefBase {
class CefEndTracingCallback : public virtual CefBase {
public:
///
// Called 0 or more times between CefBeginTracing and OnEndTracingComplete
// with a UTF8 JSON |fragment| of the specified |fragment_size|. Do not keep
// a reference to |fragment|.
// Called after all processes have sent their trace data. |tracing_file| is
// the path at which tracing data was written. The client is responsible for
// deleting |tracing_file|.
///
/*--cef()--*/
virtual void OnTraceDataCollected(const char* fragment,
size_t fragment_size) {}
///
// Called in response to CefGetTraceBufferPercentFullAsync.
///
/*--cef()--*/
virtual void OnTraceBufferPercentFullReply(float percent_full) {}
///
// Called after all processes have sent their trace data.
///
/*--cef()--*/
virtual void OnEndTracingComplete() {}
virtual void OnEndTracingComplete(const CefString& tracing_file) =0;
};
@ -91,24 +78,8 @@ class CefTraceClient : public virtual CefBase {
//
// This function must be called on the browser process UI thread.
///
/*--cef(optional_param=client,optional_param=categories)--*/
bool CefBeginTracing(CefRefPtr<CefTraceClient> client,
const CefString& categories);
///
// Get the maximum trace buffer percent full state across all processes.
//
// CefTraceClient::OnTraceBufferPercentFullReply will be called asynchronously
// after the value is determined. When any child process reaches 100% full
// tracing will end automatically and CefTraceClient::OnEndTracingComplete
// will be called. This function fails and returns false if trace is ending or
// disabled, no CefTraceClient was passed to CefBeginTracing, or if a previous
// call to CefGetTraceBufferPercentFullAsync is pending.
//
// This function must be called on the browser process UI thread.
///
/*--cef()--*/
bool CefGetTraceBufferPercentFullAsync();
/*--cef(optional_param=categories)--*/
bool CefBeginTracing(const CefString& categories);
///
// Stop tracing events on all processes.
@ -116,10 +87,16 @@ bool CefGetTraceBufferPercentFullAsync();
// This function will fail and return false if a previous call to
// CefEndTracingAsync is already pending or if CefBeginTracing was not called.
//
// |tracing_file| is the path at which tracing data will be written and
// |callback| is the callback that will be executed once all processes have
// sent their trace data. If |tracing_file| is empty a new temporary file path
// will be used. If |callback| is empty no trace data will be written.
//
// This function must be called on the browser process UI thread.
///
/*--cef()--*/
bool CefEndTracingAsync();
/*--cef(optional_param=tracing_file,optional_param=callback)--*/
bool CefEndTracingAsync(const CefString& tracing_file,
CefRefPtr<CefEndTracingCallback> callback);
///
// Returns the current system trace time or, if none is defined, the current

View File

@ -89,25 +89,26 @@ struct CefStringTraitsWide {
}
#if defined(BUILDING_CEF_SHARED)
#if defined(WCHAR_T_IS_UTF32)
static inline string16 to_string16(const struct_type *s) {
static inline base::string16 to_string16(const struct_type *s) {
cef_string_utf16_t cstr;
memset(&cstr, 0, sizeof(cstr));
cef_string_wide_to_utf16(s->str, s->length, &cstr);
string16 str;
base::string16 str;
if (cstr.length > 0)
str = string16(cstr.str, cstr.length);
str = base::string16(cstr.str, cstr.length);
cef_string_utf16_clear(&cstr);
return str;
}
static inline bool from_string16(const string16& str, struct_type *s) {
static inline bool from_string16(const base::string16& str,
struct_type *s) {
return cef_string_utf16_to_wide(str.c_str(), str.length(), s) ?
true : false;
}
#else // WCHAR_T_IS_UTF32
static inline string16 to_string16(const struct_type *s) {
return string16(s->str, s->length);
static inline base::string16 to_string16(const struct_type *s) {
return base::string16(s->str, s->length);
}
static inline bool from_string16(const string16& str, struct_type *s) {
static inline bool from_string16(const base::string16& str, struct_type *s) {
return cef_string_wide_set(str.c_str(), str.length(), s, true) ?
true : false;
}
@ -162,17 +163,17 @@ struct CefStringTraitsUTF8 {
return cef_string_wide_to_utf8(str.c_str(), str.length(), s) ? true : false;
}
#if defined(BUILDING_CEF_SHARED)
static inline string16 to_string16(const struct_type* s) {
static inline base::string16 to_string16(const struct_type* s) {
cef_string_utf16_t cstr;
memset(&cstr, 0, sizeof(cstr));
cef_string_utf8_to_utf16(s->str, s->length, &cstr);
string16 str;
base::string16 str;
if (cstr.length > 0)
str = string16(cstr.str, cstr.length);
str = base::string16(cstr.str, cstr.length);
cef_string_utf16_clear(&cstr);
return str;
}
static inline bool from_string16(const string16& str, struct_type* s) {
static inline bool from_string16(const base::string16& str, struct_type* s) {
return cef_string_utf16_to_utf8(str.c_str(), str.length(), s) ?
true : false;
}
@ -245,10 +246,10 @@ struct CefStringTraitsUTF16 {
}
#endif // WCHAR_T_IS_UTF32
#if defined(BUILDING_CEF_SHARED)
static inline string16 to_string16(const struct_type* s) {
return string16(s->str, s->length);
static inline base::string16 to_string16(const struct_type* s) {
return base::string16(s->str, s->length);
}
static inline bool from_string16(const string16& str, struct_type* s) {
static inline bool from_string16(const base::string16& str, struct_type* s) {
return cef_string_utf16_set(str.c_str(), str.length(), s, true) ?
true : false;
}
@ -339,14 +340,14 @@ class CefStringBase {
// copied. Translation will occur if necessary based on the underlying string
// type.
///
CefStringBase(const string16& src) // NOLINT(runtime/explicit)
CefStringBase(const base::string16& src) // NOLINT(runtime/explicit)
: string_(NULL), owner_(false) {
FromString16(src);
}
CefStringBase(const char16* src) // NOLINT(runtime/explicit)
: string_(NULL), owner_(false) {
if (src)
FromString16(string16(src));
FromString16(base::string16(src));
}
#endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32
@ -616,9 +617,9 @@ class CefStringBase {
// Return this string's data as a string16. Translation will occur if
// necessary based on the underlying string type.
///
string16 ToString16() const {
base::string16 ToString16() const {
if (empty())
return string16();
return base::string16();
return traits::to_string16(string_);
}
@ -627,7 +628,7 @@ class CefStringBase {
// copied. Translation will occur if necessary based on the underlying string
// type.
///
bool FromString16(const string16& str) {
bool FromString16(const base::string16& str) {
if (str.empty()) {
clear();
return true;
@ -689,15 +690,15 @@ class CefStringBase {
return *this;
}
#if (defined(BUILDING_CEF_SHARED) && defined(WCHAR_T_IS_UTF32))
operator string16() const {
operator base::string16() const {
return ToString16();
}
CefStringBase& operator=(const string16& str) {
CefStringBase& operator=(const base::string16& str) {
FromString16(str);
return *this;
}
CefStringBase& operator=(const char16* str) {
FromString16(string16(str));
FromString16(base::string16(str));
return *this;
}
#endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32

View File

@ -1361,7 +1361,7 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForRequest(
if (!info)
return NULL;
return GetOrCreateFrame(info->GetFrameID(), info->GetParentFrameID(),
info->IsMainFrame(), string16(), GURL());
info->IsMainFrame(), base::string16(), GURL());
}
void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) {
@ -1753,9 +1753,9 @@ void CefBrowserHostImpl::UpdateTargetURL(content::WebContents* source,
bool CefBrowserHostImpl::AddMessageToConsole(content::WebContents* source,
int32 level,
const string16& message,
const base::string16& message,
int32 line_no,
const string16& source_id) {
const base::string16& source_id) {
if (client_.get()) {
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
if (handler.get())
@ -1865,7 +1865,7 @@ bool CefBrowserHostImpl::ShouldCreateWebContents(
content::WebContents* web_contents,
int route_id,
WindowContainerType window_container_type,
const string16& frame_name,
const base::string16& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) {
@ -1884,7 +1884,7 @@ bool CefBrowserHostImpl::ShouldCreateWebContents(
void CefBrowserHostImpl::WebContentsCreated(
content::WebContents* source_contents,
int64 source_frame_id,
const string16& frame_name,
const base::string16& frame_name,
const GURL& target_url,
content::WebContents* new_contents) {
scoped_ptr<PendingPopupInfo> pending_popup_info;
@ -2061,13 +2061,14 @@ void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
void CefBrowserHostImpl::DidCommitProvisionalLoadForFrame(
int64 frame_id,
const string16& frame_unique_name,
const base::string16& frame_unique_name,
bool is_main_frame,
const GURL& url,
content::PageTransition transition_type,
content::RenderViewHost* render_view_host) {
CefRefPtr<CefFrame> frame = GetOrCreateFrame(frame_id,
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(), url);
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, base::string16(),
url);
OnLoadStart(frame, url, transition_type);
if (is_main_frame)
OnAddressChange(frame, url);
@ -2075,14 +2076,14 @@ void CefBrowserHostImpl::DidCommitProvisionalLoadForFrame(
void CefBrowserHostImpl::DidFailProvisionalLoad(
int64 frame_id,
const string16& frame_unique_name,
const base::string16& frame_unique_name,
bool is_main_frame,
const GURL& validated_url,
int error_code,
const string16& error_description,
const base::string16& error_description,
content::RenderViewHost* render_view_host) {
CefRefPtr<CefFrame> frame = GetOrCreateFrame(frame_id,
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(),
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, base::string16(),
GURL());
OnLoadError(frame, validated_url, error_code, error_description);
}
@ -2097,10 +2098,10 @@ void CefBrowserHostImpl::DidFailLoad(
const GURL& validated_url,
bool is_main_frame,
int error_code,
const string16& error_description,
const base::string16& error_description,
content::RenderViewHost* render_view_host) {
CefRefPtr<CefFrame> frame = GetOrCreateFrame(frame_id,
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(),
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, base::string16(),
validated_url);
OnLoadError(frame, validated_url, error_code, error_description);
OnLoadEnd(frame, validated_url, error_code);
@ -2158,7 +2159,7 @@ bool CefBrowserHostImpl::Send(IPC::Message* message) {
void CefBrowserHostImpl::OnFrameIdentified(int64 frame_id,
int64 parent_frame_id,
string16 name) {
base::string16 name) {
bool is_main_frame = (parent_frame_id == CefFrameHostImpl::kMainFrameId);
GetOrCreateFrame(frame_id, parent_frame_id, is_main_frame, name, GURL());
}
@ -2168,7 +2169,7 @@ void CefBrowserHostImpl::OnDidFinishLoad(int64 frame_id,
bool is_main_frame,
int http_status_code) {
CefRefPtr<CefFrame> frame = GetOrCreateFrame(frame_id,
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(),
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, base::string16(),
validated_url);
// Give internal scheme handlers an opportunity to update content.
@ -2238,7 +2239,7 @@ void CefBrowserHostImpl::Observe(int type,
if (type == content::NOTIFICATION_LOAD_STOP ||
type == content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED) {
string16 title;
base::string16 title;
if (type == content::NOTIFICATION_LOAD_STOP) {
content::NavigationController* controller =
@ -2347,7 +2348,7 @@ CefBrowserHostImpl::CefBrowserHostImpl(
CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(
int64 frame_id, int64 parent_frame_id, bool is_main_frame,
string16 frame_name, const GURL& frame_url) {
base::string16 frame_name, const GURL& frame_url) {
DCHECK(frame_id > CefFrameHostImpl::kInvalidFrameId);
if (frame_id <= CefFrameHostImpl::kInvalidFrameId)
return NULL;
@ -2480,7 +2481,7 @@ void CefBrowserHostImpl::OnLoadStart(CefRefPtr<CefFrame> frame,
void CefBrowserHostImpl::OnLoadError(CefRefPtr<CefFrame> frame,
const GURL& url,
int error_code,
const string16& error_description) {
const base::string16& error_description) {
if (client_.get()) {
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
if (handler.get()) {
@ -2548,7 +2549,8 @@ void CefBrowserHostImpl::RunFileChooserOnUIThread(
}
std::vector<CefString> accept_types;
std::vector<string16>::const_iterator it = params.accept_types.begin();
std::vector<base::string16>::const_iterator it =
params.accept_types.begin();
for (; it != params.accept_types.end(); ++it)
accept_types.push_back(*it);

View File

@ -315,9 +315,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
const GURL& url) OVERRIDE;
virtual bool AddMessageToConsole(content::WebContents* source,
int32 level,
const string16& message,
const base::string16& message,
int32 line_no,
const string16& source_id) OVERRIDE;
const base::string16& source_id) OVERRIDE;
virtual void BeforeUnloadFired(content::WebContents* source,
bool proceed,
bool* proceed_to_fire_unload) OVERRIDE;
@ -341,13 +341,13 @@ class CefBrowserHostImpl : public CefBrowserHost,
content::WebContents* web_contents,
int route_id,
WindowContainerType window_container_type,
const string16& frame_name,
const base::string16& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) OVERRIDE;
virtual void WebContentsCreated(content::WebContents* source_contents,
int64 source_frame_id,
const string16& frame_name,
const base::string16& frame_name,
const GURL& target_url,
content::WebContents* new_contents) OVERRIDE;
virtual void DidNavigateMainFramePostCommit(
@ -375,25 +375,25 @@ class CefBrowserHostImpl : public CefBrowserHost,
virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
virtual void DidCommitProvisionalLoadForFrame(
int64 frame_id,
const string16& frame_unique_name,
const base::string16& frame_unique_name,
bool is_main_frame,
const GURL& url,
content::PageTransition transition_type,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidFailProvisionalLoad(
int64 frame_id,
const string16& frame_unique_name,
const base::string16& frame_unique_name,
bool is_main_frame,
const GURL& validated_url,
int error_code,
const string16& error_description,
const base::string16& error_description,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DocumentAvailableInMainFrame() OVERRIDE;
virtual void DidFailLoad(int64 frame_id,
const GURL& validated_url,
bool is_main_frame,
int error_code,
const string16& error_description,
const base::string16& error_description,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) OVERRIDE;
@ -402,7 +402,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
virtual bool Send(IPC::Message* message) OVERRIDE;
// content::WebContentsObserver::OnMessageReceived() message handlers.
void OnFrameIdentified(int64 frame_id, int64 parent_frame_id, string16 name);
void OnFrameIdentified(int64 frame_id,
int64 parent_frame_id,
base::string16 name);
void OnDidFinishLoad(
int64 frame_id,
const GURL& validated_url,
@ -430,7 +432,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefRefPtr<CefFrame> GetOrCreateFrame(int64 frame_id,
int64 parent_frame_id,
bool is_main_frame,
string16 frame_name,
base::string16 frame_name,
const GURL& frame_url);
// Remove the reference to the frame and mark it as detached.
void DetachFrame(int64 frame_id);
@ -492,7 +494,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
void OnLoadError(CefRefPtr<CefFrame> frame,
const GURL& url,
int error_code,
const string16& error_description);
const base::string16& error_description);
void OnLoadEnd(CefRefPtr<CefFrame> frame,
const GURL& url,
int http_status_code);
@ -592,7 +594,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
bool file_chooser_pending_;
// Current title for the main frame. Only accessed on the UI thread.
string16 title_;
base::string16 title_;
#if defined(USE_AURA)
// Widget hosting the web contents. It will be deleted automatically when the

View File

@ -80,7 +80,7 @@ std::string GetDescriptionFromMimeType(const std::string& mime_type) {
}
void AddFiltersForAcceptTypes(GtkFileChooser* chooser,
const std::vector<string16>& accept_types,
const std::vector<base::string16>& accept_types,
bool include_all_files) {
bool has_filter = false;

View File

@ -125,7 +125,7 @@ namespace {
// Accept-types to file-types helper.
NSMutableArray* GetFileTypesFromAcceptTypes(
const std::vector<string16>& accept_types) {
const std::vector<base::string16>& accept_types) {
NSMutableArray* acceptArray = [[NSMutableArray alloc] init];
for (size_t i=0; i<accept_types.size(); i++) {
std::string ascii_type = UTF16ToASCII(accept_types[i]);
@ -150,7 +150,7 @@ void RunOpenFileDialog(const content::FileChooserParams& params,
std::vector<base::FilePath>* files) {
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
string16 title;
base::string16 title;
if (!params.title.empty()) {
title = params.title;
} else {
@ -209,7 +209,7 @@ bool RunSaveFileDialog(const content::FileChooserParams& params,
base::FilePath* file) {
NSSavePanel* savePanel = [NSSavePanel savePanel];
string16 title;
base::string16 title;
if (!params.title.empty())
title = params.title;
else

View File

@ -30,6 +30,7 @@
#include "third_party/WebKit/public/web/win/WebInputEventFactory.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/win/hwnd_util.h"
#include "ui/views/background.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/widget/widget.h"
@ -194,7 +195,7 @@ std::wstring GetDescriptionFromMimeType(const std::string& mime_type) {
}
std::wstring GetFilterStringFromAcceptTypes(
const std::vector<string16>& accept_types) {
const std::vector<base::string16>& accept_types) {
std::vector<std::wstring> extensions;
std::vector<std::wstring> descriptions;

View File

@ -66,7 +66,7 @@ class CefAccessTokenStore : public content::AccessTokenStore {
}
virtual void SaveAccessToken(
const GURL& server_url, const string16& access_token) OVERRIDE {
const GURL& server_url, const base::string16& access_token) OVERRIDE {
access_token_set_[server_url] = access_token;
}
@ -282,7 +282,7 @@ void TranslatePopupFeatures(const blink::WebWindowFeatures& webKitFeatures,
CefString str;
for (unsigned int i = 0; i < webKitFeatures.additionalFeatures.size(); ++i) {
str = string16(webKitFeatures.additionalFeatures[i]);
str = base::string16(webKitFeatures.additionalFeatures[i]);
cef_string_list_append(features.additionalFeatures, str.GetStruct());
}
}

View File

@ -153,7 +153,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
int opener_view_id;
int64 opener_frame_id;
GURL target_url;
string16 target_frame_name;
base::string16 target_frame_name;
};
void set_last_create_window_params(const LastCreateWindowParams& params);

View File

@ -238,7 +238,7 @@ bool CefContext::Initialize(const CefMainArgs& args,
cache_path_ = base::FilePath(CefString(&settings.cache_path));
if (!cache_path_.empty() &&
!base::DirectoryExists(cache_path_) &&
!file_util::CreateDirectory(cache_path_)) {
!base::CreateDirectory(cache_path_)) {
NOTREACHED() << "The cache_path directory could not be created";
cache_path_ = base::FilePath();
}

View File

@ -21,6 +21,7 @@
#include "base/logging.h"
#include "base/threading/thread_restrictions.h"
#include "content/browser/net/sqlite_persistent_cookie_store.h"
#include "content/public/browser/cookie_crypto_delegate.h"
#include "net/cookies/cookie_util.h"
#include "net/cookies/parsed_cookie.h"
#include "net/url_request/url_request_context.h"
@ -287,7 +288,7 @@ bool CefCookieManagerImpl::SetStoragePath(
// allowing file IO on this thread.
base::ThreadRestrictions::ScopedAllowIO allow_io;
if (base::DirectoryExists(new_path) ||
file_util::CreateDirectory(new_path)) {
base::CreateDirectory(new_path)) {
const base::FilePath& cookie_path = new_path.AppendASCII("Cookies");
persistent_store =
new content::SQLitePersistentCookieStore(
@ -295,7 +296,8 @@ bool CefCookieManagerImpl::SetStoragePath(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
persist_session_cookies,
NULL);
NULL,
scoped_ptr<content::CookieCryptoDelegate>());
} else {
NOTREACHED() << "The cookie storage directory could not be created";
storage_path_.clear();

View File

@ -10,8 +10,10 @@
#include "base/command_line.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/devtools_http_handler.h"
#include "content/public/browser/devtools_manager.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/common/content_client.h"
@ -81,6 +83,12 @@ void CefDevToolsFrontend::RenderViewCreated(
agent_host_.get(), frontend_host_.get());
}
void CefDevToolsFrontend::DocumentOnLoadCompletedInMainFrame(int32 page_id) {
web_contents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
base::string16(),
ASCIIToUTF16("InspectorFrontendAPI.setUseSoftMenu(true);"));
}
void CefDevToolsFrontend::WebContentsDestroyed(
content::WebContents* web_contents) {
content::DevToolsManager::GetInstance()->ClientHostClosing(

View File

@ -46,6 +46,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
// WebContentsObserver overrides
virtual void RenderViewCreated(
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DocumentOnLoadCompletedInMainFrame(int32 page_id) OVERRIDE;
virtual void WebContentsDestroyed(
content::WebContents* web_contents) OVERRIDE;

View File

@ -98,7 +98,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
// Create the directory if necessary.
base::FilePath dir_path = suggested_path.DirName();
if (!base::DirectoryExists(dir_path) &&
!file_util::CreateDirectory(dir_path)) {
!base::CreateDirectory(dir_path)) {
NOTREACHED() << "failed to create the download directory";
suggested_path.clear();
}
@ -322,7 +322,7 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
base::FilePath suggested_name = net::GenerateFileName(
item->GetURL(),
item->GetContentDisposition(),
EmptyString(),
std::string(),
item->GetSuggestedFilename(),
item->GetMimeType(),
"download");

View File

@ -28,9 +28,9 @@ class CefJavaScriptDialog {
CefJavaScriptDialog(
CefJavaScriptDialogManager* creator,
content::JavaScriptMessageType message_type,
const string16& display_url,
const string16& message_text,
const string16& default_prompt_text,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const content::JavaScriptDialogManager::DialogClosedCallback& callback);
~CefJavaScriptDialog();
@ -50,8 +50,8 @@ class CefJavaScriptDialog {
content::JavaScriptMessageType message_type_;
HWND dialog_win_;
HWND parent_win_;
string16 message_text_;
string16 default_prompt_text_;
base::string16 message_text_;
base::string16 default_prompt_text_;
static INT_PTR CALLBACK DialogProc(HWND dialog, UINT message, WPARAM wparam,
LPARAM lparam);

View File

@ -19,12 +19,12 @@ const char kPromptTextId[] = "cef_prompt_text";
// If there's a text entry in the dialog, get the text from the first one and
// return it.
string16 GetPromptText(GtkDialog* dialog) {
base::string16 GetPromptText(GtkDialog* dialog) {
GtkWidget* widget = static_cast<GtkWidget*>(
g_object_get_data(G_OBJECT(dialog), kPromptTextId));
if (widget)
return UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(widget)));
return string16();
return base::string16();
}
} // namespace
@ -32,9 +32,9 @@ string16 GetPromptText(GtkDialog* dialog) {
CefJavaScriptDialog::CefJavaScriptDialog(
CefJavaScriptDialogManager* creator,
content::JavaScriptMessageType message_type,
const string16& display_url,
const string16& message_text,
const string16& default_prompt_text,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const content::JavaScriptDialogManager::DialogClosedCallback& callback)
: creator_(creator),
callback_(callback) {
@ -123,7 +123,7 @@ void CefJavaScriptDialog::OnResponse(GtkWidget* dialog, int response_id) {
break;
case GTK_RESPONSE_CANCEL:
case GTK_RESPONSE_DELETE_EVENT:
callback_.Run(false, string16());
callback_.Run(false, base::string16());
break;
default:
NOTREACHED();

View File

@ -68,7 +68,7 @@
return;
bool success = returnCode == NSAlertFirstButtonReturn;
string16 input;
base::string16 input;
if (textField_)
input = base::SysNSStringToUTF16([textField_ stringValue]);
@ -88,9 +88,9 @@
CefJavaScriptDialog::CefJavaScriptDialog(
CefJavaScriptDialogManager* creator,
content::JavaScriptMessageType message_type,
const string16& display_url,
const string16& message_text,
const string16& default_prompt_text,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const content::JavaScriptDialogManager::DialogClosedCallback& callback)
: creator_(creator),
callback_(callback) {
@ -113,7 +113,7 @@ CefJavaScriptDialog::CefJavaScriptDialog(
[alert setDelegate:helper_];
[alert setInformativeText:base::SysUTF16ToNSString(message_text)];
string16 label;
base::string16 label;
switch (message_type) {
case content::JAVASCRIPT_MESSAGE_TYPE_ALERT:
label = ASCIIToUTF16("JavaScript Alert");

View File

@ -55,7 +55,7 @@ class CefJSDialogCallbackImpl : public CefJSDialogCallback {
static void CancelNow(
const content::JavaScriptDialogManager::DialogClosedCallback& callback) {
CEF_REQUIRE_UIT();
callback.Run(false, string16());
callback.Run(false, base::string16());
}
content::JavaScriptDialogManager::DialogClosedCallback callback_;
@ -79,8 +79,8 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
const GURL& origin_url,
const std::string& accept_lang,
content::JavaScriptMessageType message_type,
const string16& message_text,
const string16& default_prompt_text,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
bool* did_suppress_message) {
CefRefPtr<CefClient> client = browser_->GetClient();
@ -116,7 +116,7 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
return;
}
string16 display_url = net::FormatUrl(origin_url, accept_lang);
base::string16 display_url = net::FormatUrl(origin_url, accept_lang);
dialog_.reset(new CefJavaScriptDialog(this,
message_type,
@ -133,14 +133,14 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
content::WebContents* web_contents,
const string16& message_text,
const base::string16& message_text,
bool is_reload,
const DialogClosedCallback& callback) {
if (browser_->destruction_state() >=
CefBrowserHostImpl::DESTRUCTION_STATE_ACCEPTED) {
// Currently destroying the browser. Accept the unload without showing
// the prompt.
callback.Run(true, string16());
callback.Run(true, base::string16());
return;
}
@ -164,24 +164,24 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
if (dialog_.get()) {
// Seriously!?
callback.Run(true, string16());
callback.Run(true, base::string16());
return;
}
string16 new_message_text =
base::string16 new_message_text =
message_text +
ASCIIToUTF16("\n\nIs it OK to leave/reload this page?");
dialog_.reset(
new CefJavaScriptDialog(this,
content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM,
string16(), // display_url
base::string16(), // display_url
new_message_text,
string16(), // default_prompt_text
base::string16(), // default_prompt_text
callback));
#else
// TODO(port): implement CefJavaScriptDialog for other platforms.
callback.Run(true, string16());
callback.Run(true, base::string16());
return;
#endif
}

View File

@ -27,14 +27,14 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
const GURL& origin_url,
const std::string& accept_lang,
content::JavaScriptMessageType message_type,
const string16& message_text,
const string16& default_prompt_text,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
bool* did_suppress_message) OVERRIDE;
virtual void RunBeforeUnloadDialog(
content::WebContents* web_contents,
const string16& message_text,
const base::string16& message_text,
bool is_reload,
const DialogClosedCallback& callback) OVERRIDE;

View File

@ -39,7 +39,7 @@ INT_PTR CALLBACK CefJavaScriptDialog::DialogProc(HWND dialog,
GetWindowLongPtr(dialog, DWLP_USER));
if (owner) {
owner->Cancel();
owner->callback_.Run(false, string16());
owner->callback_.Run(false, base::string16());
owner->creator_->DialogClosed(owner);
// No need for the system to call DestroyWindow() because it will be
@ -51,7 +51,7 @@ INT_PTR CALLBACK CefJavaScriptDialog::DialogProc(HWND dialog,
case WM_COMMAND: {
CefJavaScriptDialog* owner = reinterpret_cast<CefJavaScriptDialog*>(
GetWindowLongPtr(dialog, DWLP_USER));
string16 user_input;
base::string16 user_input;
bool finish = false;
bool result;
switch (LOWORD(wparam)) {
@ -88,9 +88,9 @@ INT_PTR CALLBACK CefJavaScriptDialog::DialogProc(HWND dialog,
CefJavaScriptDialog::CefJavaScriptDialog(
CefJavaScriptDialogManager* creator,
content::JavaScriptMessageType message_type,
const string16& display_url,
const string16& message_text,
const string16& default_prompt_text,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const content::JavaScriptDialogManager::DialogClosedCallback& callback)
: creator_(creator),
callback_(callback),
@ -130,7 +130,7 @@ CefJavaScriptDialog::CefJavaScriptDialog(
TCHAR text[64];
GetWindowText(dialog_win_, text, sizeof(text)/sizeof(TCHAR));
string16 new_window_text = text + ASCIIToUTF16(" - ") + display_url;
base::string16 new_window_text = text + ASCIIToUTF16(" - ") + display_url;
SetWindowText(dialog_win_, new_window_text.c_str());
}

View File

@ -24,7 +24,8 @@
namespace {
CefString GetLabel(int message_id) {
string16 label = CefContentClient::Get()->GetLocalizedString(message_id);
base::string16 label =
CefContentClient::Get()->GetLocalizedString(message_id);
DCHECK(!label.empty());
return label;
}

View File

@ -64,7 +64,7 @@ class CefSimpleMenuModel : public ui::MenuModel {
return impl_->GetCommandIdAt(index);
}
virtual string16 GetLabelAt(int index) const OVERRIDE {
virtual base::string16 GetLabelAt(int index) const OVERRIDE {
return impl_->GetLabelAt(index).ToString16();
}

View File

@ -100,8 +100,8 @@ void PrintViewManagerBase::RenderProcessGone(base::TerminationStatus status) {
}
}
string16 PrintViewManagerBase::RenderSourceName() {
string16 name(web_contents()->GetTitle());
base::string16 PrintViewManagerBase::RenderSourceName() {
base::string16 name(web_contents()->GetTitle());
if (name.empty())
name = l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE);
return name;

View File

@ -43,7 +43,7 @@ class PrintViewManagerBase : public content::NotificationObserver,
void UpdateScriptedPrintingBlocked();
// PrintedPagesSource implementation.
virtual string16 RenderSourceName() OVERRIDE;
virtual base::string16 RenderSourceName() OVERRIDE;
protected:
explicit PrintViewManagerBase(content::WebContents* web_contents);

View File

@ -155,7 +155,7 @@ void PrintingMessageFilter::OnAllocateTempFileForPrinting(
*sequence_number = g_printing_file_descriptor_map.Get().sequence++;
base::FilePath path;
if (file_util::CreateTemporaryFile(&path)) {
if (base::CreateTemporaryFile(&path)) {
int fd = open(path.value().c_str(), O_WRONLY);
if (fd >= 0) {
SequenceToPathMap::iterator it = map->find(*sequence_number);
@ -231,7 +231,7 @@ void PrintingMessageFilter::CreatePrintDialogForFile(
wc->GetView()->GetTopLevelNativeWindow(),
path,
wc->GetTitle(),
string16(),
base::string16(),
std::string("application/pdf"),
false);
}
@ -382,7 +382,7 @@ void PrintingMessageFilter::OnScriptedPrintReply(
if (params.params.dpi && params.params.document_cookie) {
#if defined(OS_ANDROID)
int file_descriptor;
const string16& device_name = printer_query->settings().device_name();
const base::string16& device_name = printer_query->settings().device_name();
if (base::StringToInt(device_name, &file_descriptor)) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,

View File

@ -266,7 +266,16 @@ void CefRenderWidgetHostViewOSR::WillWmDestroy() {
void CefRenderWidgetHostViewOSR::SetParentNativeViewAccessible(
gfx::NativeViewAccessible accessible_parent) {
}
#endif
gfx::NativeViewId
CefRenderWidgetHostViewOSR::GetParentForWindowlessPlugin() const {
if (browser_impl_.get()) {
return reinterpret_cast<gfx::NativeViewId>(
browser_impl_->GetWindowHandle());
}
return NULL;
}
#endif // defined(OS_WIN) && defined(USE_AURA)
void CefRenderWidgetHostViewOSR::GetScreenInfo(blink::WebScreenInfo* results) {
if (!browser_impl_.get())
@ -327,7 +336,8 @@ void CefRenderWidgetHostViewOSR::Destroy() {
delete this;
}
void CefRenderWidgetHostViewOSR::SetTooltipText(const string16& tooltip_text) {
void CefRenderWidgetHostViewOSR::SetTooltipText(
const base::string16& tooltip_text) {
if (!browser_impl_.get())
return;
@ -675,9 +685,6 @@ float CefRenderWidgetHostViewOSR::GetDeviceScaleFactor() const {
}
#if defined(OS_MACOSX)
void CefRenderWidgetHostViewOSR::AboutToWaitForBackingStoreMsg() {
}
bool CefRenderWidgetHostViewOSR::PostProcessEventForPluginIme(
const content::NativeWebKeyboardEvent& event) {
return false;

View File

@ -141,6 +141,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase {
#if defined(OS_WIN) && defined(USE_AURA)
virtual void SetParentNativeViewAccessible(
gfx::NativeViewAccessible accessible_parent) OVERRIDE;
virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE;
#endif
virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE;
virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
@ -148,7 +149,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase {
const std::vector<AccessibilityHostMsg_EventParams>& params)
OVERRIDE;
virtual void Destroy() OVERRIDE;
virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE;
virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE;
virtual void SelectionBoundsChanged(
const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE;
virtual void ScrollOffsetChanged() OVERRIDE;
@ -188,8 +189,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase {
#endif
#if defined(OS_MACOSX)
virtual void AboutToWaitForBackingStoreMsg() OVERRIDE;
virtual bool PostProcessEventForPluginIme(
const content::NativeWebKeyboardEvent& event) OVERRIDE;
#endif

View File

@ -37,7 +37,7 @@ void InstallInternalProtectedHandlers(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)))));
#if !defined(DISABLE_FTP_SUPPORT)
protocol_handlers->insert(
std::make_pair(chrome::kFtpScheme,
std::make_pair(content::kFtpScheme,
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
new net::FtpProtocolHandler(ftp_transaction_factory))));
#endif

View File

@ -56,10 +56,10 @@
NSRange selectedRange_;
// Text to be inserted which was generated by handling a key down event.
string16 textToBeInserted_;
base::string16 textToBeInserted_;
// Marked text which was generated by handling a key down event.
string16 markedText_;
base::string16 markedText_;
// Underline information of the |markedText_|.
std::vector<blink::WebCompositionUnderline> underlines_;

View File

@ -182,7 +182,8 @@ extern "C" {
// called in keyEvent: method.
if (!handlingKeyDown_) {
renderWidgetHostView_->get_render_widget_host_impl()->
ImeConfirmComposition(string16(), gfx::Range::InvalidRange(), false);
ImeConfirmComposition(base::string16(), gfx::Range::InvalidRange(),
false);
} else {
unmarkTextCalled_ = YES;
}
@ -333,7 +334,8 @@ extern "C" {
} else if (oldHasMarkedText_ && !hasMarkedText_ && !textInserted) {
if (unmarkTextCalled_) {
renderWidgetHostView_->get_render_widget_host_impl()->
ImeConfirmComposition(string16(), gfx::Range::InvalidRange(), false);
ImeConfirmComposition(base::string16(), gfx::Range::InvalidRange(),
false);
} else {
renderWidgetHostView_->get_render_widget_host_impl()->
ImeCancelComposition();

View File

@ -11,8 +11,7 @@
#include "base/debug/trace_event.h"
#include "base/time/time.h"
bool CefBeginTracing(CefRefPtr<CefTraceClient> client,
const CefString& categories) {
bool CefBeginTracing(const CefString& categories) {
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
return false;
@ -27,10 +26,11 @@ bool CefBeginTracing(CefRefPtr<CefTraceClient> client,
if (!subscriber)
return false;
return subscriber->BeginTracing(client, categories);
return subscriber->BeginTracing(categories);
}
bool CefGetTraceBufferPercentFullAsync() {
bool CefEndTracingAsync(const CefString& tracing_file,
CefRefPtr<CefEndTracingCallback> callback) {
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
return false;
@ -45,25 +45,7 @@ bool CefGetTraceBufferPercentFullAsync() {
if (!subscriber)
return false;
return subscriber->GetTraceBufferPercentFullAsync();
}
bool CefEndTracingAsync() {
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
return false;
}
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "called on invalid thread";
return false;
}
CefTraceSubscriber* subscriber = CefContext::Get()->GetTraceSubscriber();
if (!subscriber)
return false;
return subscriber->EndTracingAsync();
return subscriber->EndTracingAsync(base::FilePath(tracing_file), callback);
}
int64 CefNowFromSystemTraceTime() {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// Copyright (c) 2013 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.
@ -6,91 +6,66 @@
#include "include/cef_trace.h"
#include "libcef/browser/thread_util.h"
#include "content/public/browser/trace_controller.h"
#include "base/debug/trace_event.h"
#include "content/public/browser/tracing_controller.h"
using content::TracingController;
CefTraceSubscriber::CefTraceSubscriber()
: collecting_trace_data_(false) {
: collecting_trace_data_(false),
weak_factory_(this) {
CEF_REQUIRE_UIT();
}
CefTraceSubscriber::~CefTraceSubscriber() {
CEF_REQUIRE_UIT();
if (collecting_trace_data_)
content::TraceController::GetInstance()->CancelSubscriber(this);
if (collecting_trace_data_) {
TracingController::GetInstance()->DisableRecording(
base::FilePath(),
TracingController::TracingFileResultCallback());
}
}
bool CefTraceSubscriber::BeginTracing(CefRefPtr<CefTraceClient> client,
const std::string& categories) {
bool CefTraceSubscriber::BeginTracing(const std::string& categories) {
CEF_REQUIRE_UIT();
if (collecting_trace_data_)
return false;
collecting_trace_data_ = true;
client_ = client;
return content::TraceController::GetInstance()->BeginTracing(
this, categories, base::debug::TraceLog::GetInstance()->trace_options());
TracingController::GetInstance()->EnableRecording(
categories, TracingController::DEFAULT_OPTIONS,
TracingController::EnableRecordingDoneCallback());
return true;
}
bool CefTraceSubscriber::EndTracingAsync() {
bool CefTraceSubscriber::EndTracingAsync(
const base::FilePath& tracing_file,
CefRefPtr<CefEndTracingCallback> callback) {
CEF_REQUIRE_UIT();
if (!collecting_trace_data_)
return false;
return content::TraceController::GetInstance()->EndTracingAsync(this);
}
void CefTraceSubscriber::GetKnownCategoriesAsync(
const KnownCategoriesCallback& callback) {
CEF_REQUIRE_UIT();
DCHECK(!callback.is_null());
DCHECK(known_categories_callback_.is_null());
known_categories_callback_ = callback;
content::TraceController::GetInstance()->GetKnownCategoryGroupsAsync(this);
}
bool CefTraceSubscriber::GetTraceBufferPercentFullAsync() {
CEF_REQUIRE_UIT();
if (!collecting_trace_data_ || !client_.get())
return false;
return content::TraceController::GetInstance()->
GetTraceBufferPercentFullAsync(this);
}
void CefTraceSubscriber::OnTraceDataCollected(
const scoped_refptr<base::RefCountedString>& trace_fragment) {
CEF_REQUIRE_UIT();
DCHECK(collecting_trace_data_);
if (client_.get()) {
client_->OnTraceDataCollected(trace_fragment->data().c_str(),
trace_fragment->data().size());
TracingController::TracingFileResultCallback result_callback;
if (callback.get()) {
result_callback =
base::Bind(&CefTraceSubscriber::OnTracingFileResult,
weak_factory_.GetWeakPtr(), callback);
}
TracingController::GetInstance()->DisableRecording(
tracing_file, result_callback);
return true;
}
void CefTraceSubscriber::OnTraceBufferPercentFullReply(float percent_full) {
void CefTraceSubscriber::OnTracingFileResult(
CefRefPtr<CefEndTracingCallback> callback,
const base::FilePath& tracing_file) {
CEF_REQUIRE_UIT();
DCHECK(collecting_trace_data_);
DCHECK(client_.get());
client_->OnTraceBufferPercentFullReply(percent_full);
}
void CefTraceSubscriber::OnEndTracingComplete() {
CEF_REQUIRE_UIT();
DCHECK(collecting_trace_data_);
collecting_trace_data_ = false;
if (client_.get())
client_->OnEndTracingComplete();
}
void CefTraceSubscriber::OnKnownCategoriesCollected(
const std::set<std::string>& known_categories) {
CEF_REQUIRE_UIT();
DCHECK(!known_categories_callback_.is_null());
known_categories_callback_.Run(known_categories);
known_categories_callback_.Reset();
callback->OnEndTracingComplete(tracing_file.value());
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// Copyright (c) 2013 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.
@ -8,38 +8,27 @@
#include "include/cef_trace.h"
#include "base/debug/trace_event.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/trace_subscriber.h"
#include "base/memory/weak_ptr.h"
// May only be accessed on the browser process UI thread.
class CefTraceSubscriber : public content::TraceSubscriber {
class CefTraceSubscriber {
public:
CefTraceSubscriber();
virtual ~CefTraceSubscriber();
bool BeginTracing(CefRefPtr<CefTraceClient> client,
const std::string& categories);
bool GetTraceBufferPercentFullAsync();
bool EndTracingAsync();
typedef base::Callback<void(const std::set<std::string>&)>
KnownCategoriesCallback;
void GetKnownCategoriesAsync(const KnownCategoriesCallback& callback);
bool BeginTracing(const std::string& categories);
bool EndTracingAsync(const base::FilePath& tracing_file,
CefRefPtr<CefEndTracingCallback> callback);
private:
// content::TraceSubscriber methods:
virtual void OnTraceDataCollected(
const scoped_refptr<base::RefCountedString>& trace_fragment) OVERRIDE;
virtual void OnTraceBufferPercentFullReply(float percent_full) OVERRIDE;
virtual void OnEndTracingComplete() OVERRIDE;
virtual void OnKnownCategoriesCollected(
const std::set<std::string>& known_categories) OVERRIDE;
void OnTracingFileResult(CefRefPtr<CefEndTracingCallback> callback,
const base::FilePath& tracing_file);
bool collecting_trace_data_;
KnownCategoriesCallback known_categories_callback_;
CefRefPtr<CefTraceClient> client_;
base::WeakPtrFactory<CefTraceSubscriber> weak_factory_;
};
#endif // CEF_LIBCEF_BROWSER_TRACE_SUBSCRIBER_H_

View File

@ -160,7 +160,7 @@ void CefNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) {
}
void CefNetworkDelegate::OnPACScriptError(int line_number,
const string16& error) {
const base::string16& error) {
}
net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(

View File

@ -38,7 +38,7 @@ class CefNetworkDelegate : public net::NetworkDelegate {
OVERRIDE;
virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE;
virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE;
virtual void OnPACScriptError(int line_number, const string16& error)
virtual void OnPACScriptError(int line_number, const base::string16& error)
OVERRIDE;
virtual AuthRequiredResponse OnAuthRequired(
net::URLRequest* request,

View File

@ -29,6 +29,7 @@
#include "chrome/browser/net/proxy_service_factory.h"
#include "content/browser/net/sqlite_persistent_cookie_store.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_crypto_delegate.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
@ -263,7 +264,7 @@ void CefURLRequestContextGetter::SetCookieStoragePath(
// allowing file IO on this thread.
base::ThreadRestrictions::ScopedAllowIO allow_io;
if (base::DirectoryExists(path) ||
file_util::CreateDirectory(path)) {
base::CreateDirectory(path)) {
const base::FilePath& cookie_path = path.AppendASCII("Cookies");
persistent_store =
new content::SQLitePersistentCookieStore(
@ -271,7 +272,8 @@ void CefURLRequestContextGetter::SetCookieStoragePath(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
persist_session_cookies,
NULL);
NULL,
scoped_ptr<content::CookieCryptoDelegate>());
} else {
NOTREACHED() << "The cookie storage directory could not be created";
}

View File

@ -58,7 +58,7 @@ void CefWebContentsViewOSR::GetContainerBounds(gfx::Rect *out) const {
*out = GetViewBounds();
}
void CefWebContentsViewOSR::SetPageTitle(const string16& title) {
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {
}
void CefWebContentsViewOSR::OnTabCrashed(base::TerminationStatus status,
@ -117,6 +117,13 @@ void CefWebContentsViewOSR::SetAllowOverlappingViews(bool overlapping) {
bool CefWebContentsViewOSR::GetAllowOverlappingViews() const {
return false;
}
void CefWebContentsViewOSR::SetOverlayView(content::WebContentsView* overlay,
const gfx::Point& offset) {
}
void CefWebContentsViewOSR::RemoveOverlayView() {
}
#endif // defined(OS_MACOSX)
// RenderViewHostDelegateView methods.

View File

@ -37,7 +37,7 @@ class CefWebContentsViewOSR : public content::WebContentsViewPort,
virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
virtual void GetContainerBounds(gfx::Rect *out) const OVERRIDE;
virtual void SetPageTitle(const string16& title) OVERRIDE;
virtual void SetPageTitle(const base::string16& title) OVERRIDE;
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
@ -55,7 +55,10 @@ class CefWebContentsViewOSR : public content::WebContentsViewPort,
virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE;
virtual bool GetAllowOverlappingViews() const OVERRIDE;
#endif
virtual void SetOverlayView(content::WebContentsView* overlay,
const gfx::Point& offset) OVERRIDE;
virtual void RemoveOverlayView() OVERRIDE;
#endif // defined(OS_MACOSX)
// RenderViewHostDelegateView methods.
virtual void StartDragging(

View File

@ -26,8 +26,8 @@ void CefBreakpadClient::GetProductNameAndVersion(
*product_name = ASCIIToUTF16("cef");
*version = UTF8ToUTF16(base::StringPrintf(
"%d.%d.%d", CEF_VERSION_MAJOR, CHROME_VERSION_BUILD, CEF_REVISION));
*special_build = string16();
*channel_name = string16();
*special_build = base::string16();
*channel_name = base::string16();
}
#endif

View File

@ -163,7 +163,7 @@ IPC_SYNC_MESSAGE_CONTROL1_1(
IPC_MESSAGE_ROUTED3(CefHostMsg_FrameIdentified,
int64 /* frame_id */,
int64 /* parent_frame_id */,
string16 /* frame_name */)
base::string16 /* frame_name */)
// Sent when a frame has been detached.
IPC_MESSAGE_ROUTED1(CefHostMsg_FrameDetached,

View File

@ -82,8 +82,8 @@ std::string CefContentClient::GetUserAgent() const {
return webkit_glue::BuildUserAgentFromProduct(product_version);
}
string16 CefContentClient::GetLocalizedString(int message_id) const {
string16 value =
base::string16 CefContentClient::GetLocalizedString(int message_id) const {
base::string16 value =
ResourceBundle::GetSharedInstance().GetLocalizedString(message_id);
if (value.empty())
LOG(ERROR) << "No localized string available for id " << message_id;
@ -197,7 +197,8 @@ bool CefContentClient::GetRawDataResource(int resource_id,
return (pack_loading_disabled_ || !value->empty());
}
bool CefContentClient::GetLocalizedString(int message_id, string16* value) {
bool CefContentClient::GetLocalizedString(int message_id,
base::string16* value) {
if (application_.get()) {
CefRefPtr<CefResourceBundleHandler> handler =
application_->GetResourceBundleHandler();

View File

@ -30,7 +30,7 @@ class CefContentClient : public content::ContentClient,
std::vector<std::string>* standard_schemes,
std::vector<std::string>* savable_schemes) OVERRIDE;
virtual std::string GetUserAgent() const OVERRIDE;
virtual string16 GetLocalizedString(int message_id) const OVERRIDE;
virtual base::string16 GetLocalizedString(int message_id) const OVERRIDE;
virtual base::StringPiece GetDataResource(
int resource_id,
ui::ScaleFactor scale_factor) const OVERRIDE;
@ -77,7 +77,8 @@ class CefContentClient : public content::ContentClient,
virtual bool GetRawDataResource(int resource_id,
ui::ScaleFactor scale_factor,
base::StringPiece* value) OVERRIDE;
virtual bool GetLocalizedString(int message_id, string16* value) OVERRIDE;
virtual bool GetLocalizedString(int message_id,
base::string16* value) OVERRIDE;
virtual scoped_ptr<gfx::Font> GetFont(
ui::ResourceBundle::FontStyle style) OVERRIDE;

View File

@ -359,22 +359,22 @@ void CefMainDelegate::PreSandboxStartup() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kEnableCrashReporter)) {
const std::string& process_type = command_line.GetSwitchValueASCII(
switches::kProcessType);
breakpad::SetBreakpadClient(g_shell_breakpad_client.Pointer());
#if defined(OS_MACOSX)
base::mac::DisableOSCrashDumps();
breakpad::InitCrashReporter();
breakpad::InitCrashProcessInfo();
breakpad::InitCrashReporter(process_type);
breakpad::InitCrashProcessInfo(process_type);
#elif defined(OS_POSIX) && !defined(OS_MACOSX)
std::string process_type = command_line.GetSwitchValueASCII(
switches::kProcessType);
if (process_type != switches::kZygoteProcess)
breakpad::InitCrashReporter();
breakpad::InitCrashReporter(process_type);
#elif defined(OS_WIN)
UINT new_flags =
SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
UINT existing_flags = SetErrorMode(new_flags);
SetErrorMode(existing_flags | new_flags);
breakpad::InitCrashReporter();
breakpad::InitCrashReporter(process_type);
#endif
}
@ -431,9 +431,11 @@ void CefMainDelegate::ProcessExiting(const std::string& process_type) {
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
void CefMainDelegate::ZygoteForked() {
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableCrashReporter)) {
breakpad::InitCrashReporter();
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kEnableCrashReporter)) {
const std::string& process_type = command_line.GetSwitchValueASCII(
switches::kProcessType);
breakpad::InitCrashReporter(process_type);
}
}
#endif

View File

@ -399,7 +399,8 @@ void CefRequestImpl::GetHeaderMap(const blink::WebURLRequest& request,
virtual void visitHeader(const blink::WebString& name,
const blink::WebString& value) {
map_->insert(std::make_pair(string16(name), string16(value)));
map_->insert(std::make_pair(base::string16(name),
base::string16(value)));
}
private:
@ -415,7 +416,8 @@ void CefRequestImpl::SetHeaderMap(const HeaderMap& map,
blink::WebURLRequest& request) {
HeaderMap::const_iterator it = map.begin();
for (; it != map.end(); ++it)
request.setHTTPHeaderField(string16(it->first), string16(it->second));
request.setHTTPHeaderField(base::string16(it->first),
base::string16(it->second));
}
// CefPostData ----------------------------------------------------------------
@ -767,7 +769,7 @@ void CefPostDataElementImpl::Set(const blink::WebHTTPBody::Element& element) {
SetToBytes(element.data.size(),
static_cast<const void*>(element.data.data()));
} else if (element.type == blink::WebHTTPBody::Element::TypeFile) {
SetToFile(string16(element.filePath));
SetToFile(base::string16(element.filePath));
} else {
NOTREACHED();
}
@ -782,7 +784,7 @@ void CefPostDataElementImpl::Get(blink::WebHTTPBody::Element& element) {
static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
} else if (type_ == PDE_TYPE_FILE) {
element.type = blink::WebHTTPBody::Element::TypeFile;
element.filePath.assign(string16(CefString(&data_.filename)));
element.filePath.assign(base::string16(CefString(&data_.filename)));
} else {
NOTREACHED();
}

View File

@ -187,7 +187,8 @@ void CefResponseImpl::Set(const blink::WebURLResponse& response) {
virtual void visitHeader(const blink::WebString& name,
const blink::WebString& value) {
map_->insert(std::make_pair(string16(name), string16(value)));
map_->insert(std::make_pair(base::string16(name),
base::string16(value)));
}
private:

View File

@ -52,7 +52,7 @@ bool IsInternalProtectedScheme(const std::string& scheme) {
chrome::kFileScheme,
chrome::kFileSystemScheme,
#if !defined(DISABLE_FTP_SUPPORT)
chrome::kFtpScheme,
content::kFtpScheme,
#endif
};

View File

@ -188,7 +188,7 @@ CEF_EXPORT int cef_string_utf8_to_wide(const char* src, size_t src_len,
CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len,
cef_string_utf16_t* output) {
string16 str;
base::string16 str;
bool ret = WideToUTF16(src, src_len, &str);
if (!cef_string_utf16_set(str.c_str(), str.length(), output, true))
return false;
@ -206,7 +206,7 @@ CEF_EXPORT int cef_string_utf16_to_wide(const char16* src, size_t src_len,
CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len,
cef_string_utf16_t* output) {
string16 str;
base::string16 str;
bool ret = UTF8ToUTF16(src, src_len, &str);
if (!cef_string_utf16_set(str.c_str(), str.length(), output, true))
return false;
@ -230,7 +230,7 @@ CEF_EXPORT int cef_string_ascii_to_wide(const char* src, size_t src_len,
CEF_EXPORT int cef_string_ascii_to_utf16(const char* src, size_t src_len,
cef_string_utf16_t* output) {
string16 str = ASCIIToUTF16(std::string(src, src_len));
base::string16 str = ASCIIToUTF16(std::string(src, src_len));
return cef_string_utf16_set(str.c_str(), str.length(), output, true);
}

View File

@ -320,7 +320,7 @@ void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) {
}
if (params.upload_data.get()) {
string16 method = request.httpMethod();
base::string16 method = request.httpMethod();
if (method == ASCIIToUTF16("GET") || method == ASCIIToUTF16("HEAD"))
request.setHTTPMethod(ASCIIToUTF16("POST"));
@ -390,7 +390,7 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
int64 parent_id = frame->parent() == NULL ?
kInvalidFrameId : frame->parent()->identifier();
string16 name = frame->uniqueName();
base::string16 name = frame->uniqueName();
// Notify the browser that the frame has been identified.
Send(new CefHostMsg_FrameIdentified(routing_id(), frame_id, parent_id, name));

View File

@ -35,12 +35,13 @@ MSVC_POP_WARNING();
#include "chrome/renderer/loadtimes_extension_bindings.h"
#include "chrome/renderer/printing/print_web_view_helper.h"
#include "content/child/child_thread.h"
#include "content/common/frame_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_constants.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "content/renderer/render_view_impl.h"
#include "content/renderer/render_frame_impl.h"
#include "ipc/ipc_sync_channel.h"
#include "media/base/media.h"
#include "third_party/WebKit/public/platform/WebPrerenderingSupport.h"
@ -457,7 +458,7 @@ void CefContentRendererClient::RenderViewCreated(
}
bool CefContentRendererClient::OverrideCreatePlugin(
content::RenderView* render_view,
content::RenderFrame* render_frame,
blink::WebFrame* frame,
const blink::WebPluginParams& params,
blink::WebPlugin** plugin) {
@ -470,16 +471,21 @@ bool CefContentRendererClient::OverrideCreatePlugin(
if (UTF16ToASCII(params.mimeType) == content::kBrowserPluginMimeType)
return false;
content::RenderViewImpl* render_view_impl =
static_cast<content::RenderViewImpl*>(render_view);
content::RenderFrameImpl* render_frame_impl =
static_cast<content::RenderFrameImpl*>(render_frame);
content::WebPluginInfo info;
std::string mime_type;
bool found = render_view_impl->GetPluginInfo(params.url,
frame->top()->document().url(),
params.mimeType.utf8(),
&info,
&mime_type);
bool found = false;
render_frame_impl->Send(
new FrameHostMsg_GetPluginInfo(
render_frame_impl->GetRoutingID(),
params.url,
frame->top()->document().url(),
params.mimeType.utf8(),
&found,
&info,
&mime_type));
if (!found)
return false;
@ -527,7 +533,7 @@ bool CefContentRendererClient::OverrideCreatePlugin(
params_to_use.attributeNames.swap(new_names);
params_to_use.attributeValues.swap(new_values);
*plugin = render_view_impl->CreatePlugin(frame, info, params_to_use);
*plugin = render_frame_impl->CreatePlugin(frame, info, params_to_use);
return true;
}
#endif // defined(ENABLE_PLUGINS)
@ -536,6 +542,9 @@ bool CefContentRendererClient::OverrideCreatePlugin(
}
bool CefContentRendererClient::HandleNavigation(
content::RenderView* view,
content::DocumentState* document_state,
int opener_id,
blink::WebFrame* frame,
const blink::WebURLRequest& request,
blink::WebNavigationType type,
@ -602,12 +611,13 @@ void CefContentRendererClient::DidCreateScriptContext(
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame);
v8::HandleScope handle_scope(webkit_glue::GetV8Isolate(frame));
v8::Isolate* isolate = webkit_glue::GetV8Isolate(frame);
v8::HandleScope handle_scope(isolate);
v8::Context::Scope scope(context);
WebCore::V8RecursionScope recursion_scope(
WebCore::toExecutionContext(context));
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(context));
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(isolate, context));
// Notify the render process handler.
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
@ -633,12 +643,14 @@ void CefContentRendererClient::WillReleaseScriptContext(
if (browserPtr.get()) {
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame);
v8::HandleScope handle_scope(webkit_glue::GetV8Isolate(frame));
v8::Isolate* isolate = webkit_glue::GetV8Isolate(frame);
v8::HandleScope handle_scope(isolate);
v8::Context::Scope scope(context);
WebCore::V8RecursionScope recursion_scope(
WebCore::toExecutionContext(context));
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(context));
CefRefPtr<CefV8Context> contextPtr(
new CefV8ContextImpl(isolate, context));
handler->OnContextReleased(browserPtr.get(), framePtr.get(),
contextPtr);

View File

@ -77,11 +77,14 @@ class CefContentRendererClient : public content::ContentRendererClient,
virtual void RenderThreadStarted() OVERRIDE;
virtual void RenderViewCreated(content::RenderView* render_view) OVERRIDE;
virtual bool OverrideCreatePlugin(
content::RenderView* render_view,
content::RenderFrame* render_frame,
blink::WebFrame* frame,
const blink::WebPluginParams& params,
blink::WebPlugin** plugin) OVERRIDE;
virtual bool HandleNavigation(blink::WebFrame* frame,
virtual bool HandleNavigation(content::RenderView* view,
content::DocumentState* document_state,
int opener_id,
blink::WebFrame* frame,
const blink::WebURLRequest& request,
blink::WebNavigationType type,
blink::WebNavigationPolicy default_policy,

View File

@ -83,7 +83,7 @@ CefString CefDOMDocumentImpl::GetTitle() {
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetElementById(const CefString& id) {
const WebDocument& document = frame_->document();
return GetOrCreateNode(document.getElementById(string16(id)));
return GetOrCreateNode(document.getElementById(base::string16(id)));
}
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetFocusedNode() {
@ -189,7 +189,7 @@ CefString CefDOMDocumentImpl::GetCompleteURL(const CefString& partialURL) {
return str;
const WebDocument& document = frame_->document();
const WebURL& url = document.completeURL(string16(partialURL));
const WebURL& url = document.completeURL(base::string16(partialURL));
if (!url.isNull()) {
GURL gurl = url;
str = gurl.spec();

View File

@ -197,7 +197,7 @@ CefString CefDOMNodeImpl::GetFormControlElementType() {
const WebFormControlElement& formElement =
node_.toConst<WebFormControlElement>();
const string16& form_control_type = formElement.formControlType();
const base::string16& form_control_type = formElement.formControlType();
str = form_control_type;
}
}
@ -240,8 +240,8 @@ CefString CefDOMNodeImpl::GetValue() {
const WebFormControlElement& formElement =
node_.toConst<WebFormControlElement>();
string16 value;
const string16& form_control_type = formElement.formControlType();
base::string16 value;
const base::string16& form_control_type = formElement.formControlType();
if (form_control_type == ASCIIToUTF16("text")) {
const WebInputElement& input_element =
formElement.toConst<WebInputElement>();
@ -273,7 +273,7 @@ bool CefDOMNodeImpl::SetValue(const CefString& value) {
if (node_.isElementNode())
return false;
return webkit_glue::SetNodeValue(node_, string16(value));
return webkit_glue::SetNodeValue(node_, base::string16(value));
}
CefString CefDOMNodeImpl::GetAsMarkup() {
@ -343,7 +343,7 @@ void CefDOMNodeImpl::AddEventListener(const CefString& eventType,
if (!VerifyContext())
return;
node_.addEventListener(string16(eventType),
node_.addEventListener(base::string16(eventType),
new CefDOMEventListenerWrapper(document_->GetBrowser(),
document_->GetFrame(), listener),
useCapture);
@ -390,7 +390,7 @@ bool CefDOMNodeImpl::HasElementAttribute(const CefString& attrName) {
}
const WebElement& element = node_.toConst<blink::WebElement>();
return element.hasAttribute(string16(attrName));
return element.hasAttribute(base::string16(attrName));
}
CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) {
@ -404,7 +404,7 @@ CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) {
}
const WebElement& element = node_.toConst<blink::WebElement>();
const WebString& attr = element.getAttribute(string16(attrName));
const WebString& attr = element.getAttribute(base::string16(attrName));
if (!attr.isNull())
str = attr;
@ -426,8 +426,8 @@ void CefDOMNodeImpl::GetElementAttributes(AttributeMap& attrMap) {
return;
for (unsigned int i = 0; i < len; ++i) {
string16 name = element.attributeLocalName(i);
string16 value = element.attributeValue(i);
base::string16 name = element.attributeLocalName(i);
base::string16 value = element.attributeValue(i);
attrMap.insert(std::make_pair(name, value));
}
}
@ -443,7 +443,8 @@ bool CefDOMNodeImpl::SetElementAttribute(const CefString& attrName,
}
WebElement element = node_.to<blink::WebElement>();
return element.setAttribute(string16(attrName), string16(value));
return element.setAttribute(base::string16(attrName),
base::string16(value));
}
CefString CefDOMNodeImpl::GetElementInnerText() {

View File

@ -238,8 +238,9 @@ CefRefPtr<CefV8Context> CefFrameImpl::GetV8Context() {
CEF_REQUIRE_RT_RETURN(NULL);
if (frame_) {
v8::HandleScope handle_scope(webkit_glue::GetV8Isolate(frame_));
return new CefV8ContextImpl(webkit_glue::GetV8Context(frame_));
v8::Isolate* isolate = webkit_glue::GetV8Isolate(frame_);
v8::HandleScope handle_scope(isolate);
return new CefV8ContextImpl(isolate, webkit_glue::GetV8Context(frame_));
} else {
return NULL;
}

View File

@ -88,8 +88,8 @@ class CefV8IsolateManager {
return scoped_refptr<CefV8ContextState>();
if (context.IsEmpty()) {
if (v8::Context::InContext())
context = v8::Context::GetCurrent();
if (isolate_->InContext())
context = isolate_->GetCurrentContext();
else
return scoped_refptr<CefV8ContextState>();
}
@ -105,7 +105,8 @@ class CefV8IsolateManager {
return state;
} else {
v8::Handle<v8::String> key = v8::String::New(kCefContextState);
v8::Handle<v8::String> key =
v8::String::NewFromUtf8(isolate_, kCefContextState);
v8::Handle<v8::Object> object = context->Global();
v8::Handle<v8::Value> value = object->GetHiddenValue(key);
@ -115,7 +116,7 @@ class CefV8IsolateManager {
}
scoped_refptr<CefV8ContextState> state = new CefV8ContextState();
object->SetHiddenValue(key, v8::External::New(state.get()));
object->SetHiddenValue(key, v8::External::New(isolate_, state.get()));
// Reference will be released in ReleaseContext.
state->AddRef();
@ -126,6 +127,7 @@ class CefV8IsolateManager {
void ReleaseContext(v8::Handle<v8::Context> context) {
DCHECK_EQ(isolate_, v8::Isolate::GetCurrent());
DCHECK_EQ(isolate_, context->GetIsolate());
if (context_safety_impl_ == IMPL_DISABLED)
return;
@ -138,7 +140,8 @@ class CefV8IsolateManager {
context_map_.erase(it);
}
} else {
v8::Handle<v8::String> key = v8::String::New(kCefContextState);
v8::Handle<v8::String> key =
v8::String::NewFromUtf8(isolate_, kCefContextState);
v8::Handle<v8::Object> object = context->Global();
v8::Handle<v8::Value> value = object->GetHiddenValue(key);
if (value.IsEmpty())
@ -261,13 +264,15 @@ CefV8IsolateManager* GetIsolateManager() {
class V8TrackObject : public CefTrackNode {
public:
V8TrackObject()
: external_memory_(0) {
v8::V8::AdjustAmountOfExternalAllocatedMemory(
explicit V8TrackObject(v8::Isolate* isolate)
: isolate_(isolate),
external_memory_(0) {
DCHECK(isolate_);
isolate_->AdjustAmountOfExternalAllocatedMemory(
static_cast<int>(sizeof(V8TrackObject)));
}
~V8TrackObject() {
v8::V8::AdjustAmountOfExternalAllocatedMemory(
isolate_->AdjustAmountOfExternalAllocatedMemory(
-static_cast<int>(sizeof(V8TrackObject)) - external_memory_);
}
@ -284,7 +289,7 @@ class V8TrackObject : public CefTrackNode {
}
if (change_in_bytes != 0)
v8::V8::AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
isolate_->AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
external_memory_ = new_value;
return new_value;
@ -316,14 +321,17 @@ class V8TrackObject : public CefTrackNode {
// Attach this track object to the specified V8 object.
void AttachTo(v8::Handle<v8::Object> object) {
object->SetHiddenValue(v8::String::New(kCefTrackObject),
v8::External::New(this));
object->SetHiddenValue(v8::String::NewFromUtf8(isolate_, kCefTrackObject),
v8::External::New(isolate_, this));
}
// Retrieve the track object for the specified V8 object.
static V8TrackObject* Unwrap(v8::Handle<v8::Object> object) {
static V8TrackObject* Unwrap(v8::Isolate* isolate,
v8::Handle<v8::Object> object) {
DCHECK(isolate);
v8::Local<v8::Value> value =
object->GetHiddenValue(v8::String::New(kCefTrackObject));
object->GetHiddenValue(
v8::String::NewFromUtf8(isolate, kCefTrackObject));
if (!value.IsEmpty())
return static_cast<V8TrackObject*>(v8::External::Cast(*value)->Value());
@ -331,6 +339,7 @@ class V8TrackObject : public CefTrackNode {
}
private:
v8::Isolate* isolate_;
CefRefPtr<CefV8Accessor> accessor_;
CefRefPtr<CefV8Handler> handler_;
CefRefPtr<CefBase> user_data_;
@ -351,13 +360,16 @@ class V8TrackString : public CefTrackNode {
// or Function.
class CefV8MakeWeakParam {
public:
CefV8MakeWeakParam(scoped_refptr<CefV8ContextState> context_state,
CefV8MakeWeakParam(v8::Isolate* isolate,
scoped_refptr<CefV8ContextState> context_state,
CefTrackNode* object)
: context_state_(context_state),
: isolate_(isolate),
context_state_(context_state),
object_(object) {
DCHECK(isolate_);
DCHECK(object_);
v8::V8::AdjustAmountOfExternalAllocatedMemory(
isolate_->AdjustAmountOfExternalAllocatedMemory(
static_cast<int>(sizeof(CefV8MakeWeakParam)));
if (context_state_.get()) {
@ -383,42 +395,48 @@ class CefV8MakeWeakParam {
GetIsolateManager()->DeleteGlobalTrackObject(object_);
}
v8::V8::AdjustAmountOfExternalAllocatedMemory(
isolate_->AdjustAmountOfExternalAllocatedMemory(
-static_cast<int>(sizeof(CefV8MakeWeakParam)));
}
private:
v8::Isolate* isolate_;
scoped_refptr<CefV8ContextState> context_state_;
CefTrackNode* object_;
};
// Callback for weak persistent reference destruction.
void TrackDestructor(v8::Isolate* isolate,
v8::Persistent<v8::Value>* object,
CefV8MakeWeakParam* parameter) {
if (parameter)
delete parameter;
object->Reset();
object->Clear();
void TrackDestructor(
const v8::WeakCallbackData<v8::Value, CefV8MakeWeakParam>& data) {
if (data.GetParameter())
delete data.GetParameter();
}
// Convert a CefString to a V8::String.
v8::Handle<v8::String> GetV8String(const CefString& str) {
v8::Handle<v8::String> GetV8String(v8::Isolate* isolate,
const CefString& str) {
#if defined(CEF_STRING_TYPE_UTF16)
// Already a UTF16 string.
return v8::String::New(
return v8::String::NewFromTwoByte(
isolate,
reinterpret_cast<uint16_t*>(
const_cast<CefString::char_type*>(str.c_str())),
v8::String::kNormalString,
str.length());
#elif defined(CEF_STRING_TYPE_UTF8)
// Already a UTF8 string.
return v8::String::New(const_cast<char*>(str.c_str()), str.length());
return v8::String::NewFromUtf8(isolate,
const_cast<char*>(str.c_str()),
v8::String::kNormalString,
str.length());
#else
// Convert the string to UTF8.
std::string tmpStr = str;
return v8::String::New(tmpStr.c_str(), tmpStr.length());
return v8::String::NewFromUtf8(isolate,
tmpStr.c_str(),
v8::String::kNormalString,
tmpStr.length());
#endif
}
@ -477,27 +495,29 @@ void GetCefString(v8::Handle<v8::String> str, CefString& out) {
// V8 function callback.
void FunctionCallbackImpl(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
WebCore::V8RecursionScope recursion_scope(
WebCore::toExecutionContext(v8::Context::GetCurrent()));
WebCore::toExecutionContext(isolate->GetCurrentContext()));
CefV8Handler* handler =
static_cast<CefV8Handler*>(v8::External::Cast(*info.Data())->Value());
CefV8ValueList params;
for (int i = 0; i < info.Length(); i++)
params.push_back(new CefV8ValueImpl(info[i]));
params.push_back(new CefV8ValueImpl(isolate, info[i]));
CefString func_name;
GetCefString(v8::Handle<v8::String>::Cast(info.Callee()->GetName()),
func_name);
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(info.This());
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, info.This());
CefRefPtr<CefV8Value> retval;
CefString exception;
if (handler->Execute(func_name, object, params, retval, exception)) {
if (!exception.empty()) {
info.GetReturnValue().Set(
v8::ThrowException(v8::Exception::Error(GetV8String(exception))));
isolate->ThrowException(
v8::Exception::Error(GetV8String(isolate, exception))));
return;
} else {
CefV8ValueImpl* rv = static_cast<CefV8ValueImpl*>(retval.get());
@ -515,26 +535,28 @@ void FunctionCallbackImpl(const v8::FunctionCallbackInfo<v8::Value>& info) {
void AccessorGetterCallbackImpl(
v8::Local<v8::String> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
WebCore::V8RecursionScope recursion_scope(
WebCore::toExecutionContext(v8::Context::GetCurrent()));
WebCore::toExecutionContext(isolate->GetCurrentContext()));
v8::Handle<v8::Object> obj = info.This();
CefRefPtr<CefV8Accessor> accessorPtr;
V8TrackObject* tracker = V8TrackObject::Unwrap(obj);
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
if (tracker)
accessorPtr = tracker->GetAccessor();
if (accessorPtr.get()) {
CefRefPtr<CefV8Value> retval;
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(obj);
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, obj);
CefString name, exception;
GetCefString(property, name);
if (accessorPtr->Get(name, object, retval, exception)) {
if (!exception.empty()) {
info.GetReturnValue().Set(
v8::ThrowException(v8::Exception::Error(GetV8String(exception))));
isolate->ThrowException(
v8::Exception::Error(GetV8String(isolate, exception))));
return;
} else {
CefV8ValueImpl* rv = static_cast<CefV8ValueImpl*>(retval.get());
@ -553,25 +575,27 @@ void AccessorSetterCallbackImpl(
v8::Local<v8::String> property,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info) {
v8::Isolate* isolate = info.GetIsolate();
WebCore::V8RecursionScope recursion_scope(
WebCore::toExecutionContext(v8::Context::GetCurrent()));
WebCore::toExecutionContext(isolate->GetCurrentContext()));
v8::Handle<v8::Object> obj = info.This();
CefRefPtr<CefV8Accessor> accessorPtr;
V8TrackObject* tracker = V8TrackObject::Unwrap(obj);
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
if (tracker)
accessorPtr = tracker->GetAccessor();
if (accessorPtr.get()) {
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(obj);
CefRefPtr<CefV8Value> cefValue = new CefV8ValueImpl(value);
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, obj);
CefRefPtr<CefV8Value> cefValue = new CefV8ValueImpl(isolate, value);
CefString name, exception;
GetCefString(property, name);
accessorPtr->Set(name, object, cefValue, exception);
if (!exception.empty()) {
v8::ThrowException(v8::Exception::Error(GetV8String(exception)));
isolate->ThrowException(
v8::Exception::Error(GetV8String(isolate, exception)));
return;
}
}
@ -617,21 +641,17 @@ class ExtensionWrapper : public v8::Extension {
const char* javascript_code,
CefV8Handler* handler)
: v8::Extension(extension_name, javascript_code), handler_(handler) {
if (handler) {
// The reference will be released when the process exits.
V8TrackObject* object = new V8TrackObject;
object->SetHandler(handler);
GetIsolateManager()->AddGlobalTrackObject(object);
}
}
virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
v8::Handle<v8::String> name) {
virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate(
v8::Isolate* isolate,
v8::Handle<v8::String> name) OVERRIDE {
if (!handler_)
return v8::Handle<v8::FunctionTemplate>();
return v8::FunctionTemplate::New(FunctionCallbackImpl,
v8::External::New(handler_));
return v8::FunctionTemplate::New(isolate,
FunctionCallbackImpl,
v8::External::New(isolate, handler_));
}
private:
@ -695,10 +715,12 @@ void MessageListenerCallbackImpl(v8::Handle<v8::Message> message,
if (!handler.get())
return;
v8::Isolate* isolate = GetIsolateManager()->isolate();
CefRefPtr<CefV8Context> context = CefV8Context::GetCurrentContext();
v8::Handle<v8::StackTrace> v8Stack = message->GetStackTrace();
DCHECK(!v8Stack.IsEmpty());
CefRefPtr<CefV8StackTrace> stackTrace = new CefV8StackTraceImpl(v8Stack);
CefRefPtr<CefV8StackTrace> stackTrace =
new CefV8StackTraceImpl(isolate, v8Stack);
CefRefPtr<CefV8Exception> exception = new CefV8ExceptionImpl(message);
@ -739,13 +761,24 @@ bool CefRegisterExtension(const CefString& extension_name,
// Verify that this method was called on the correct thread.
CEF_REQUIRE_RT_RETURN(false);
V8TrackString* name = new V8TrackString(extension_name);
GetIsolateManager()->AddGlobalTrackObject(name);
V8TrackString* code = new V8TrackString(javascript_code);
GetIsolateManager()->AddGlobalTrackObject(code);
CefV8IsolateManager* isolate_manager = GetIsolateManager();
ExtensionWrapper* wrapper = new ExtensionWrapper(name->GetString(),
code->GetString(), handler.get());
V8TrackString* name = new V8TrackString(extension_name);
isolate_manager->AddGlobalTrackObject(name);
V8TrackString* code = new V8TrackString(javascript_code);
isolate_manager->AddGlobalTrackObject(code);
if (handler) {
// The reference will be released when the process exits.
V8TrackObject* object = new V8TrackObject(isolate_manager->isolate());
object->SetHandler(handler);
isolate_manager->AddGlobalTrackObject(object);
}
ExtensionWrapper* wrapper = new ExtensionWrapper(
name->GetString(),
code->GetString(),
handler.get());
content::RenderThread::Get()->RegisterExtension(wrapper);
return true;
@ -801,11 +834,15 @@ bool CefV8HandleBase::BelongsToCurrentThread() const {
return task_runner_->RunsTasksOnCurrentThread();
}
CefV8HandleBase::CefV8HandleBase(v8::Handle<v8::Context> context) {
CefV8HandleBase::CefV8HandleBase(v8::Isolate* isolate,
v8::Handle<v8::Context> context)
: isolate_(isolate) {
DCHECK(isolate_);
CefV8IsolateManager* manager = GetIsolateManager();
DCHECK(manager);
DCHECK_EQ(isolate_, manager->isolate());
isolate_ = manager->isolate();
task_runner_ = manager->task_runner();
context_state_ = manager->GetContextState(context);
}
@ -817,9 +854,10 @@ CefV8HandleBase::CefV8HandleBase(v8::Handle<v8::Context> context) {
CefRefPtr<CefV8Context> CefV8Context::GetCurrentContext() {
CefRefPtr<CefV8Context> context;
CEF_V8_REQUIRE_ISOLATE_RETURN(context);
if (v8::Context::InContext()) {
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
context = new CefV8ContextImpl(v8::Context::GetCurrent());
v8::Isolate* isolate = GetIsolateManager()->isolate();
if (isolate->InContext()) {
v8::HandleScope handle_scope(isolate);
context = new CefV8ContextImpl(isolate, isolate->GetCurrentContext());
}
return context;
}
@ -828,9 +866,10 @@ CefRefPtr<CefV8Context> CefV8Context::GetCurrentContext() {
CefRefPtr<CefV8Context> CefV8Context::GetEnteredContext() {
CefRefPtr<CefV8Context> context;
CEF_V8_REQUIRE_ISOLATE_RETURN(context);
if (v8::Context::InContext()) {
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
context = new CefV8ContextImpl(v8::Context::GetEntered());
v8::Isolate* isolate = GetIsolateManager()->isolate();
if (isolate->InContext()) {
v8::HandleScope handle_scope(isolate);
context = new CefV8ContextImpl(isolate, isolate->GetEnteredContext());
}
return context;
}
@ -838,14 +877,16 @@ CefRefPtr<CefV8Context> CefV8Context::GetEnteredContext() {
// static
bool CefV8Context::InContext() {
CEF_V8_REQUIRE_ISOLATE_RETURN(false);
return v8::Context::InContext();
v8::Isolate* isolate = GetIsolateManager()->isolate();
return isolate->InContext();
}
// CefV8ContextImpl
CefV8ContextImpl::CefV8ContextImpl(v8::Handle<v8::Context> context)
: handle_(new Handle(context, context))
CefV8ContextImpl::CefV8ContextImpl(v8::Isolate* isolate,
v8::Handle<v8::Context> context)
: handle_(new Handle(isolate, context, context))
#ifndef NDEBUG
, enter_count_(0)
#endif
@ -900,10 +941,11 @@ CefRefPtr<CefFrame> CefV8ContextImpl::GetFrame() {
CefRefPtr<CefV8Value> CefV8ContextImpl::GetGlobal() {
CEF_V8_REQUIRE_VALID_HANDLE_RETURN(NULL);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Context> context = GetV8Context();
v8::Context::Scope context_scope(context);
return new CefV8ValueImpl(context->Global());
return new CefV8ValueImpl(isolate, context->Global());
}
bool CefV8ContextImpl::Enter() {
@ -954,18 +996,19 @@ bool CefV8ContextImpl::Eval(const CefString& code,
return false;
}
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = GetV8Context();
v8::Context::Scope context_scope(context);
v8::Local<v8::Object> obj = context->Global();
// Retrieve the eval function.
v8::Local<v8::Value> val = obj->Get(v8::String::New("eval"));
v8::Local<v8::Value> val = obj->Get(v8::String::NewFromUtf8(isolate, "eval"));
if (val.IsEmpty() || !val->IsFunction())
return false;
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(val);
v8::Handle<v8::Value> code_val = GetV8String(code);
v8::Handle<v8::Value> code_val = GetV8String(isolate, code);
v8::TryCatch try_catch;
try_catch.SetVerbose(true);
@ -980,7 +1023,7 @@ bool CefV8ContextImpl::Eval(const CefString& code,
exception = new CefV8ExceptionImpl(try_catch.Message());
return false;
} else if (!func_rv.IsEmpty()) {
retval = new CefV8ValueImpl(func_rv);
retval = new CefV8ValueImpl(isolate, func_rv);
}
return true;
}
@ -1006,12 +1049,12 @@ CefV8ValueImpl::Handle::~Handle() {
// from a V8 callback, and
// B. The associated context, if any, is still valid.
if (should_persist_ && (!context_state_.get() || context_state_->IsValid())) {
handle_.MakeWeak(
(tracker_ ? new CefV8MakeWeakParam(context_state_, tracker_) : NULL),
handle_.SetWeak(
(tracker_ ?
new CefV8MakeWeakParam(isolate(), context_state_, tracker_) : NULL),
TrackDestructor);
} else {
handle_.Reset();
handle_.Clear();
if (tracker_)
delete tracker_;
@ -1025,7 +1068,8 @@ CefV8ValueImpl::Handle::~Handle() {
// static
CefRefPtr<CefV8Value> CefV8Value::CreateUndefined() {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
v8::Isolate* isolate = GetIsolateManager()->isolate();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitUndefined();
return impl.get();
}
@ -1033,7 +1077,8 @@ CefRefPtr<CefV8Value> CefV8Value::CreateUndefined() {
// static
CefRefPtr<CefV8Value> CefV8Value::CreateNull() {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
v8::Isolate* isolate = GetIsolateManager()->isolate();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitNull();
return impl.get();
}
@ -1041,7 +1086,8 @@ CefRefPtr<CefV8Value> CefV8Value::CreateNull() {
// static
CefRefPtr<CefV8Value> CefV8Value::CreateBool(bool value) {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
v8::Isolate* isolate = GetIsolateManager()->isolate();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitBool(value);
return impl.get();
}
@ -1049,7 +1095,8 @@ CefRefPtr<CefV8Value> CefV8Value::CreateBool(bool value) {
// static
CefRefPtr<CefV8Value> CefV8Value::CreateInt(int32 value) {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
v8::Isolate* isolate = GetIsolateManager()->isolate();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitInt(value);
return impl.get();
}
@ -1057,7 +1104,8 @@ CefRefPtr<CefV8Value> CefV8Value::CreateInt(int32 value) {
// static
CefRefPtr<CefV8Value> CefV8Value::CreateUInt(uint32 value) {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
v8::Isolate* isolate = GetIsolateManager()->isolate();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitUInt(value);
return impl.get();
}
@ -1065,7 +1113,8 @@ CefRefPtr<CefV8Value> CefV8Value::CreateUInt(uint32 value) {
// static
CefRefPtr<CefV8Value> CefV8Value::CreateDouble(double value) {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
v8::Isolate* isolate = GetIsolateManager()->isolate();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitDouble(value);
return impl.get();
}
@ -1073,7 +1122,8 @@ CefRefPtr<CefV8Value> CefV8Value::CreateDouble(double value) {
// static
CefRefPtr<CefV8Value> CefV8Value::CreateDate(const CefTime& value) {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
v8::Isolate* isolate = GetIsolateManager()->isolate();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitDate(value);
return impl.get();
}
@ -1081,7 +1131,8 @@ CefRefPtr<CefV8Value> CefV8Value::CreateDate(const CefTime& value) {
// static
CefRefPtr<CefV8Value> CefV8Value::CreateString(const CefString& value) {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
v8::Isolate* isolate = GetIsolateManager()->isolate();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
CefString str(value);
impl->InitString(str);
return impl.get();
@ -1092,9 +1143,10 @@ CefRefPtr<CefV8Value> CefV8Value::CreateObject(
CefRefPtr<CefV8Accessor> accessor) {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
v8::Isolate* isolate = GetIsolateManager()->isolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::GetCurrent();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
if (context.IsEmpty()) {
NOTREACHED() << "not currently in a V8 context";
return NULL;
@ -1105,13 +1157,13 @@ CefRefPtr<CefV8Value> CefV8Value::CreateObject(
// Create a tracker object that will cause the user data and/or accessor
// reference to be released when the V8 object is destroyed.
V8TrackObject* tracker = new V8TrackObject;
V8TrackObject* tracker = new V8TrackObject(isolate);
tracker->SetAccessor(accessor);
// Attach the tracker object.
tracker->AttachTo(obj);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitObject(obj, tracker);
return impl.get();
}
@ -1120,9 +1172,10 @@ CefRefPtr<CefV8Value> CefV8Value::CreateObject(
CefRefPtr<CefV8Value> CefV8Value::CreateArray(int length) {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
v8::Isolate* isolate = GetIsolateManager()->isolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::GetCurrent();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
if (context.IsEmpty()) {
NOTREACHED() << "not currently in a V8 context";
return NULL;
@ -1130,15 +1183,15 @@ CefRefPtr<CefV8Value> CefV8Value::CreateArray(int length) {
// Create a tracker object that will cause the user data reference to be
// released when the V8 object is destroyed.
V8TrackObject* tracker = new V8TrackObject;
V8TrackObject* tracker = new V8TrackObject(isolate);
// Create the new V8 array.
v8::Local<v8::Array> arr = v8::Array::New(length);
v8::Local<v8::Array> arr = v8::Array::New(isolate, length);
// Attach the tracker object.
tracker->AttachTo(arr);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitObject(arr, tracker);
return impl.get();
}
@ -1154,18 +1207,19 @@ CefRefPtr<CefV8Value> CefV8Value::CreateFunction(
return NULL;
}
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
v8::Isolate* isolate = GetIsolateManager()->isolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::GetCurrent();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
if (context.IsEmpty()) {
NOTREACHED() << "not currently in a V8 context";
return NULL;
}
// Create a new V8 function template.
v8::Local<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
v8::Local<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New(isolate);
v8::Local<v8::Value> data = v8::External::New(handler.get());
v8::Local<v8::Value> data = v8::External::New(isolate, handler.get());
// Set the function handler callback.
tmpl->SetCallHandler(FunctionCallbackImpl, data);
@ -1177,11 +1231,11 @@ CefRefPtr<CefV8Value> CefV8Value::CreateFunction(
return NULL;
}
func->SetName(GetV8String(name));
func->SetName(GetV8String(isolate, name));
// Create a tracker object that will cause the user data and/or handler
// reference to be released when the V8 object is destroyed.
V8TrackObject* tracker = new V8TrackObject;
V8TrackObject* tracker = new V8TrackObject(isolate);
tracker->SetHandler(handler);
// Attach the tracker object.
@ -1189,7 +1243,7 @@ CefRefPtr<CefV8Value> CefV8Value::CreateFunction(
// Create the CefV8ValueImpl and provide a tracker object that will cause
// the handler reference to be released when the V8 object is destroyed.
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl();
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitObject(func, tracker);
return impl.get();
}
@ -1197,14 +1251,19 @@ CefRefPtr<CefV8Value> CefV8Value::CreateFunction(
// CefV8ValueImpl
CefV8ValueImpl::CefV8ValueImpl()
: type_(TYPE_INVALID),
CefV8ValueImpl::CefV8ValueImpl(v8::Isolate* isolate)
: isolate_(isolate),
type_(TYPE_INVALID),
rethrow_exceptions_(false) {
DCHECK(isolate_);
}
CefV8ValueImpl::CefV8ValueImpl(v8::Handle<v8::Value> value)
: type_(TYPE_INVALID),
CefV8ValueImpl::CefV8ValueImpl(v8::Isolate* isolate,
v8::Handle<v8::Value> value)
: isolate_(isolate),
type_(TYPE_INVALID),
rethrow_exceptions_(false) {
DCHECK(isolate_);
InitFromV8Value(value);
}
@ -1301,28 +1360,28 @@ void CefV8ValueImpl::InitString(CefString& value) {
void CefV8ValueImpl::InitObject(v8::Handle<v8::Value> value, CefTrackNode* tracker) {
DCHECK_EQ(type_, TYPE_INVALID);
type_ = TYPE_OBJECT;
handle_ = new Handle(v8::Handle<v8::Context>(), value, tracker);
handle_ = new Handle(isolate_, v8::Handle<v8::Context>(), value, tracker);
}
v8::Handle<v8::Value> CefV8ValueImpl::GetV8Value(bool should_persist) {
switch (type_) {
case TYPE_UNDEFINED:
return v8::Undefined();
return v8::Undefined(isolate_);
case TYPE_NULL:
return v8::Null();
return v8::Null(isolate_);
case TYPE_BOOL:
return v8::Boolean::New(bool_value_);
return v8::Boolean::New(isolate_, bool_value_);
case TYPE_INT:
return v8::Int32::New(int_value_);
return v8::Int32::New(isolate_, int_value_);
case TYPE_UINT:
return v8::Uint32::New(uint_value_);
return v8::Uint32::New(isolate_, uint_value_);
case TYPE_DOUBLE:
return v8::Number::New(double_value_);
return v8::Number::New(isolate_, double_value_);
case TYPE_DATE:
// Convert from seconds to milliseconds.
return v8::Date::New(CefTime(date_value_).GetDoubleT() * 1000);
return v8::Date::New(isolate_, CefTime(date_value_).GetDoubleT() * 1000);
case TYPE_STRING:
return GetV8String(CefString(&string_value_));
return GetV8String(isolate_, CefString(&string_value_));
case TYPE_OBJECT:
return handle_->GetNewV8Handle(should_persist);
default:
@ -1493,11 +1552,12 @@ CefString CefV8ValueImpl::GetStringValue() {
bool CefV8ValueImpl::IsUserCreated() {
CEF_V8_REQUIRE_OBJECT_RETURN(false);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
V8TrackObject* tracker = V8TrackObject::Unwrap(obj);
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
return (tracker != NULL);
}
@ -1536,10 +1596,11 @@ bool CefV8ValueImpl::SetRethrowExceptions(bool rethrow) {
bool CefV8ValueImpl::HasValue(const CefString& key) {
CEF_V8_REQUIRE_OBJECT_RETURN(false);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
return obj->Has(GetV8String(key));
return obj->Has(GetV8String(isolate, key));
}
bool CefV8ValueImpl::HasValue(int index) {
@ -1559,13 +1620,14 @@ bool CefV8ValueImpl::HasValue(int index) {
bool CefV8ValueImpl::DeleteValue(const CefString& key) {
CEF_V8_REQUIRE_OBJECT_RETURN(false);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
v8::TryCatch try_catch;
try_catch.SetVerbose(true);
bool del = obj->Delete(GetV8String(key));
bool del = obj->Delete(GetV8String(isolate, key));
return (!HasCaught(try_catch) && del);
}
@ -1590,15 +1652,16 @@ bool CefV8ValueImpl::DeleteValue(int index) {
CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(const CefString& key) {
CEF_V8_REQUIRE_OBJECT_RETURN(NULL);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
v8::TryCatch try_catch;
try_catch.SetVerbose(true);
v8::Local<v8::Value> ret_value = obj->Get(GetV8String(key));
v8::Local<v8::Value> ret_value = obj->Get(GetV8String(isolate, key));
if (!HasCaught(try_catch) && !ret_value.IsEmpty())
return new CefV8ValueImpl(ret_value);
return new CefV8ValueImpl(isolate, ret_value);
return NULL;
}
@ -1610,15 +1673,16 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(int index) {
return NULL;
}
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
v8::TryCatch try_catch;
try_catch.SetVerbose(true);
v8::Local<v8::Value> ret_value = obj->Get(v8::Number::New(index));
v8::Local<v8::Value> ret_value = obj->Get(v8::Number::New(isolate, index));
if (!HasCaught(try_catch) && !ret_value.IsEmpty())
return new CefV8ValueImpl(ret_value);
return new CefV8ValueImpl(isolate, ret_value);
return NULL;
}
@ -1629,13 +1693,14 @@ bool CefV8ValueImpl::SetValue(const CefString& key,
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::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
v8::TryCatch try_catch;
try_catch.SetVerbose(true);
bool set = obj->Set(GetV8String(key), impl->GetV8Value(true),
bool set = obj->Set(GetV8String(isolate, key), impl->GetV8Value(true),
static_cast<v8::PropertyAttribute>(attribute));
return (!HasCaught(try_catch) && set);
} else {
@ -1672,13 +1737,14 @@ bool CefV8ValueImpl::SetValue(const CefString& key, AccessControl settings,
PropertyAttribute attribute) {
CEF_V8_REQUIRE_OBJECT_RETURN(false);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
CefRefPtr<CefV8Accessor> accessorPtr;
V8TrackObject* tracker = V8TrackObject::Unwrap(obj);
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
if (tracker)
accessorPtr = tracker->GetAccessor();
@ -1693,7 +1759,7 @@ bool CefV8ValueImpl::SetValue(const CefString& key, AccessControl settings,
v8::TryCatch try_catch;
try_catch.SetVerbose(true);
bool set = obj->SetAccessor(GetV8String(key), getter, setter, obj,
bool set = obj->SetAccessor(GetV8String(isolate, key), getter, setter, obj,
static_cast<v8::AccessControl>(settings),
static_cast<v8::PropertyAttribute>(attribute));
return (!HasCaught(try_catch) && set);
@ -1702,14 +1768,15 @@ bool CefV8ValueImpl::SetValue(const CefString& key, AccessControl settings,
bool CefV8ValueImpl::GetKeys(std::vector<CefString>& keys) {
CEF_V8_REQUIRE_OBJECT_RETURN(false);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
v8::Local<v8::Array> arr_keys = obj->GetPropertyNames();
uint32_t len = arr_keys->Length();
for (uint32_t i = 0; i < len; ++i) {
v8::Local<v8::Value> value = arr_keys->Get(v8::Integer::New(i));
v8::Local<v8::Value> value = arr_keys->Get(v8::Integer::New(isolate, i));
CefString str;
GetCefString(value->ToString(), str);
keys.push_back(str);
@ -1720,11 +1787,12 @@ bool CefV8ValueImpl::GetKeys(std::vector<CefString>& keys) {
bool CefV8ValueImpl::SetUserData(CefRefPtr<CefBase> user_data) {
CEF_V8_REQUIRE_OBJECT_RETURN(false);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
V8TrackObject* tracker = V8TrackObject::Unwrap(obj);
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
if (tracker) {
tracker->SetUserData(user_data);
return true;
@ -1736,11 +1804,12 @@ bool CefV8ValueImpl::SetUserData(CefRefPtr<CefBase> user_data) {
CefRefPtr<CefBase> CefV8ValueImpl::GetUserData() {
CEF_V8_REQUIRE_OBJECT_RETURN(NULL);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
V8TrackObject* tracker = V8TrackObject::Unwrap(obj);
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
if (tracker)
return tracker->GetUserData();
@ -1750,11 +1819,12 @@ CefRefPtr<CefBase> CefV8ValueImpl::GetUserData() {
int CefV8ValueImpl::GetExternallyAllocatedMemory() {
CEF_V8_REQUIRE_OBJECT_RETURN(0);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
V8TrackObject* tracker = V8TrackObject::Unwrap(obj);
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
if (tracker)
return tracker->GetExternallyAllocatedMemory();
@ -1764,11 +1834,12 @@ int CefV8ValueImpl::GetExternallyAllocatedMemory() {
int CefV8ValueImpl::AdjustExternallyAllocatedMemory(int change_in_bytes) {
CEF_V8_REQUIRE_OBJECT_RETURN(0);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
v8::Handle<v8::Object> obj = value->ToObject();
V8TrackObject* tracker = V8TrackObject::Unwrap(obj);
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
if (tracker)
return tracker->AdjustExternallyAllocatedMemory(change_in_bytes);
@ -1810,7 +1881,8 @@ CefString CefV8ValueImpl::GetFunctionName() {
CefRefPtr<CefV8Handler> CefV8ValueImpl::GetFunctionHandler() {
CEF_V8_REQUIRE_OBJECT_RETURN(NULL);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
if (!value->IsFunction()) {
NOTREACHED() << "V8 value is not a function";
@ -1818,7 +1890,7 @@ CefRefPtr<CefV8Handler> CefV8ValueImpl::GetFunctionHandler() {
}
v8::Handle<v8::Object> obj = value->ToObject();
V8TrackObject* tracker = V8TrackObject::Unwrap(obj);
V8TrackObject* tracker = V8TrackObject::Unwrap(isolate, obj);
if (tracker)
return tracker->GetHandler();
@ -1839,7 +1911,8 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
const CefV8ValueList& arguments) {
CEF_V8_REQUIRE_OBJECT_RETURN(NULL);
v8::HandleScope handle_scope(handle_->isolate());
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Value> value = handle_->GetNewV8Handle(false);
if (!value->IsFunction()) {
NOTREACHED() << "V8 value is not a function";
@ -1871,7 +1944,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
static_cast<CefV8ContextImpl*>(context.get());
context_local = context_impl->GetV8Context();
} else {
context_local = v8::Context::GetCurrent();
context_local = isolate->GetCurrentContext();
}
v8::Context::Scope context_scope(context_local);
@ -1908,7 +1981,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
handle_->isolate());
if (!HasCaught(try_catch) && !func_rv.IsEmpty())
retval = new CefV8ValueImpl(func_rv);
retval = new CefV8ValueImpl(isolate, func_rv);
}
if (argv)
@ -1937,24 +2010,27 @@ bool CefV8ValueImpl::HasCaught(v8::TryCatch& try_catch) {
CefRefPtr<CefV8StackTrace> CefV8StackTrace::GetCurrent(int frame_limit) {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
v8::Isolate* isolate = GetIsolateManager()->isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::StackTrace> stackTrace =
v8::StackTrace::CurrentStackTrace(
frame_limit, v8::StackTrace::kDetailed);
isolate, frame_limit, v8::StackTrace::kDetailed);
if (stackTrace.IsEmpty())
return NULL;
return new CefV8StackTraceImpl(stackTrace);
return new CefV8StackTraceImpl(isolate, stackTrace);
}
// CefV8StackTraceImpl
CefV8StackTraceImpl::CefV8StackTraceImpl(v8::Handle<v8::StackTrace> handle) {
CefV8StackTraceImpl::CefV8StackTraceImpl(
v8::Isolate* isolate,
v8::Handle<v8::StackTrace> handle) {
int frame_count = handle->GetFrameCount();
if (frame_count > 0) {
frames_.reserve(frame_count);
for (int i = 0; i < frame_count; ++i)
frames_.push_back(new CefV8StackFrameImpl(handle->GetFrame(i)));
frames_.push_back(new CefV8StackFrameImpl(isolate, handle->GetFrame(i)));
}
}
@ -1978,7 +2054,9 @@ CefRefPtr<CefV8StackFrame> CefV8StackTraceImpl::GetFrame(int index) {
// CefV8StackFrameImpl
CefV8StackFrameImpl::CefV8StackFrameImpl(v8::Handle<v8::StackFrame> handle)
CefV8StackFrameImpl::CefV8StackFrameImpl(
v8::Isolate* isolate,
v8::Handle<v8::StackFrame> handle)
: line_number_(0),
column_(0),
is_eval_(false),

View File

@ -110,7 +110,8 @@ class CefV8HandleBase :
protected:
// |context| is the context that owns this handle. If empty the current
// context will be used.
explicit CefV8HandleBase(v8::Handle<v8::Context> context);
CefV8HandleBase(v8::Isolate* isolate,
v8::Handle<v8::Context> context);
protected:
v8::Isolate* isolate_;
@ -126,13 +127,14 @@ class CefV8Handle : public CefV8HandleBase {
typedef v8::Handle<v8class> handleType;
typedef v8::Persistent<v8class> persistentType;
CefV8Handle(v8::Handle<v8::Context> context, handleType v)
: CefV8HandleBase(context),
handle_(isolate(), v) {
CefV8Handle(v8::Isolate* isolate,
v8::Handle<v8::Context> context,
handleType v)
: CefV8HandleBase(isolate, context),
handle_(isolate, v) {
}
virtual ~CefV8Handle() {
handle_.Reset();
handle_.Clear();
}
handleType GetNewV8Handle() {
@ -159,7 +161,8 @@ class CefV8Handle<v8::Value> {
class CefV8ContextImpl : public CefV8Context {
public:
explicit CefV8ContextImpl(v8::Handle<v8::Context> context);
CefV8ContextImpl(v8::Isolate* isolate,
v8::Handle<v8::Context> context);
virtual ~CefV8ContextImpl();
virtual CefRefPtr<CefTaskRunner> GetTaskRunner() OVERRIDE;
@ -192,8 +195,9 @@ class CefV8ContextImpl : public CefV8Context {
class CefV8ValueImpl : public CefV8Value {
public:
CefV8ValueImpl();
explicit CefV8ValueImpl(v8::Handle<v8::Value> value);
explicit CefV8ValueImpl(v8::Isolate* isolate);
CefV8ValueImpl(v8::Isolate* isolate,
v8::Handle<v8::Value> value);
virtual ~CefV8ValueImpl();
// Used for initializing the CefV8ValueImpl. Should be called a single time
@ -274,9 +278,12 @@ class CefV8ValueImpl : public CefV8Value {
typedef v8::Handle<v8::Value> handleType;
typedef v8::Persistent<v8::Value> persistentType;
Handle(v8::Handle<v8::Context> context, handleType v, CefTrackNode* tracker)
: CefV8HandleBase(context),
handle_(isolate(), v),
Handle(v8::Isolate* isolate,
v8::Handle<v8::Context> context,
handleType v,
CefTrackNode* tracker)
: CefV8HandleBase(isolate, context),
handle_(isolate, v),
tracker_(tracker),
should_persist_(false) {
}
@ -305,6 +312,8 @@ class CefV8ValueImpl : public CefV8Value {
DISALLOW_COPY_AND_ASSIGN(Handle);
};
v8::Isolate* isolate_;
enum {
TYPE_INVALID = 0,
@ -340,7 +349,8 @@ class CefV8ValueImpl : public CefV8Value {
class CefV8StackTraceImpl : public CefV8StackTrace {
public:
explicit CefV8StackTraceImpl(v8::Handle<v8::StackTrace> handle);
CefV8StackTraceImpl(v8::Isolate* isolate,
v8::Handle<v8::StackTrace> handle);
virtual ~CefV8StackTraceImpl();
virtual bool IsValid() OVERRIDE;
@ -356,7 +366,8 @@ class CefV8StackTraceImpl : public CefV8StackTrace {
class CefV8StackFrameImpl : public CefV8StackFrame {
public:
explicit CefV8StackFrameImpl(v8::Handle<v8::StackFrame> handle);
CefV8StackFrameImpl(v8::Isolate* isolate,
v8::Handle<v8::StackFrame> handle);
virtual ~CefV8StackFrameImpl();
virtual bool IsValid() OVERRIDE;

View File

@ -0,0 +1,51 @@
// Copyright (c) 2013 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. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/end_tracing_callback_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK end_tracing_callback_on_end_tracing_complete(
struct _cef_end_tracing_callback_t* self,
const cef_string_t* tracing_file) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: tracing_file; type: string_byref_const
DCHECK(tracing_file);
if (!tracing_file)
return;
// Execute
CefEndTracingCallbackCppToC::Get(self)->OnEndTracingComplete(
CefString(tracing_file));
}
// CONSTRUCTOR - Do not edit by hand.
CefEndTracingCallbackCppToC::CefEndTracingCallbackCppToC(
CefEndTracingCallback* cls)
: CefCppToC<CefEndTracingCallbackCppToC, CefEndTracingCallback,
cef_end_tracing_callback_t>(cls) {
struct_.struct_.on_end_tracing_complete =
end_tracing_callback_on_end_tracing_complete;
}
#ifndef NDEBUG
template<> long CefCppToC<CefEndTracingCallbackCppToC, CefEndTracingCallback,
cef_end_tracing_callback_t>::DebugObjCt = 0;
#endif

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TRACE_CLIENT_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TRACE_CLIENT_CPPTOC_H_
#ifndef CEF_LIBCEF_DLL_CPPTOC_END_TRACING_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_END_TRACING_CALLBACK_CPPTOC_H_
#pragma once
#ifndef USING_CEF_SHARED
@ -24,14 +24,14 @@
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefTraceClientCppToC
: public CefCppToC<CefTraceClientCppToC, CefTraceClient,
cef_trace_client_t> {
class CefEndTracingCallbackCppToC
: public CefCppToC<CefEndTracingCallbackCppToC, CefEndTracingCallback,
cef_end_tracing_callback_t> {
public:
explicit CefTraceClientCppToC(CefTraceClient* cls);
virtual ~CefTraceClientCppToC() {}
explicit CefEndTracingCallbackCppToC(CefEndTracingCallback* cls);
virtual ~CefEndTracingCallbackCppToC() {}
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_TRACE_CLIENT_CPPTOC_H_
#endif // CEF_LIBCEF_DLL_CPPTOC_END_TRACING_CALLBACK_CPPTOC_H_

View File

@ -1,79 +0,0 @@
// Copyright (c) 2013 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. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/trace_client_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK trace_client_on_trace_data_collected(
struct _cef_trace_client_t* self, const char* fragment,
size_t fragment_size) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: fragment; type: simple_byaddr
DCHECK(fragment);
if (!fragment)
return;
// Execute
CefTraceClientCppToC::Get(self)->OnTraceDataCollected(
fragment,
fragment_size);
}
void CEF_CALLBACK trace_client_on_trace_buffer_percent_full_reply(
struct _cef_trace_client_t* self, float percent_full) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTraceClientCppToC::Get(self)->OnTraceBufferPercentFullReply(
percent_full);
}
void CEF_CALLBACK trace_client_on_end_tracing_complete(
struct _cef_trace_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTraceClientCppToC::Get(self)->OnEndTracingComplete();
}
// CONSTRUCTOR - Do not edit by hand.
CefTraceClientCppToC::CefTraceClientCppToC(CefTraceClient* cls)
: CefCppToC<CefTraceClientCppToC, CefTraceClient, cef_trace_client_t>(cls) {
struct_.struct_.on_trace_data_collected =
trace_client_on_trace_data_collected;
struct_.struct_.on_trace_buffer_percent_full_reply =
trace_client_on_trace_buffer_percent_full_reply;
struct_.struct_.on_end_tracing_complete =
trace_client_on_end_tracing_complete;
}
#ifndef NDEBUG
template<> long CefCppToC<CefTraceClientCppToC, CefTraceClient,
cef_trace_client_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,40 @@
// Copyright (c) 2013 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. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/end_tracing_callback_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefEndTracingCallbackCToCpp::OnEndTracingComplete(
const CefString& tracing_file) {
if (CEF_MEMBER_MISSING(struct_, on_end_tracing_complete))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: tracing_file; type: string_byref_const
DCHECK(!tracing_file.empty());
if (tracing_file.empty())
return;
// Execute
struct_->on_end_tracing_complete(struct_,
tracing_file.GetStruct());
}
#ifndef NDEBUG
template<> long CefCToCpp<CefEndTracingCallbackCToCpp, CefEndTracingCallback,
cef_end_tracing_callback_t>::DebugObjCt = 0;
#endif

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TRACE_CLIENT_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TRACE_CLIENT_CTOCPP_H_
#ifndef CEF_LIBCEF_DLL_CTOCPP_END_TRACING_CALLBACK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_END_TRACING_CALLBACK_CTOCPP_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
@ -24,22 +24,19 @@
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefTraceClientCToCpp
: public CefCToCpp<CefTraceClientCToCpp, CefTraceClient,
cef_trace_client_t> {
class CefEndTracingCallbackCToCpp
: public CefCToCpp<CefEndTracingCallbackCToCpp, CefEndTracingCallback,
cef_end_tracing_callback_t> {
public:
explicit CefTraceClientCToCpp(cef_trace_client_t* str)
: CefCToCpp<CefTraceClientCToCpp, CefTraceClient, cef_trace_client_t>(
str) {}
virtual ~CefTraceClientCToCpp() {}
explicit CefEndTracingCallbackCToCpp(cef_end_tracing_callback_t* str)
: CefCToCpp<CefEndTracingCallbackCToCpp, CefEndTracingCallback,
cef_end_tracing_callback_t>(str) {}
virtual ~CefEndTracingCallbackCToCpp() {}
// CefTraceClient methods
virtual void OnTraceDataCollected(const char* fragment,
size_t fragment_size) OVERRIDE;
virtual void OnTraceBufferPercentFullReply(float percent_full) OVERRIDE;
virtual void OnEndTracingComplete() OVERRIDE;
// CefEndTracingCallback methods
virtual void OnEndTracingComplete(const CefString& tracing_file) OVERRIDE;
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_TRACE_CLIENT_CTOCPP_H_
#endif // CEF_LIBCEF_DLL_CTOCPP_END_TRACING_CALLBACK_CTOCPP_H_

View File

@ -1,62 +0,0 @@
// Copyright (c) 2013 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. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/trace_client_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefTraceClientCToCpp::OnTraceDataCollected(const char* fragment,
size_t fragment_size) {
if (CEF_MEMBER_MISSING(struct_, on_trace_data_collected))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: fragment; type: simple_byaddr
DCHECK(fragment);
if (!fragment)
return;
// Execute
struct_->on_trace_data_collected(struct_,
fragment,
fragment_size);
}
void CefTraceClientCToCpp::OnTraceBufferPercentFullReply(float percent_full) {
if (CEF_MEMBER_MISSING(struct_, on_trace_buffer_percent_full_reply))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
struct_->on_trace_buffer_percent_full_reply(struct_,
percent_full);
}
void CefTraceClientCToCpp::OnEndTracingComplete() {
if (CEF_MEMBER_MISSING(struct_, on_end_tracing_complete))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
struct_->on_end_tracing_complete(struct_);
}
#ifndef NDEBUG
template<> long CefCToCpp<CefTraceClientCToCpp, CefTraceClient,
cef_trace_client_t>::DebugObjCt = 0;
#endif

View File

@ -80,6 +80,7 @@
#include "libcef_dll/ctocpp/display_handler_ctocpp.h"
#include "libcef_dll/ctocpp/download_handler_ctocpp.h"
#include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
#include "libcef_dll/ctocpp/end_tracing_callback_ctocpp.h"
#include "libcef_dll/ctocpp/focus_handler_ctocpp.h"
#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h"
#include "libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h"
@ -97,7 +98,6 @@
#include "libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h"
#include "libcef_dll/ctocpp/string_visitor_ctocpp.h"
#include "libcef_dll/ctocpp/task_ctocpp.h"
#include "libcef_dll/ctocpp/trace_client_ctocpp.h"
#include "libcef_dll/ctocpp/urlrequest_client_ctocpp.h"
#include "libcef_dll/ctocpp/v8accessor_ctocpp.h"
#include "libcef_dll/ctocpp/v8handler_ctocpp.h"
@ -201,6 +201,7 @@ CEF_EXPORT void cef_shutdown() {
DCHECK_EQ(CefDownloadItemCppToC::DebugObjCt, 0);
DCHECK_EQ(CefDragDataCppToC::DebugObjCt, 0);
DCHECK_EQ(CefDragHandlerCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefEndTracingCallbackCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefFileDialogCallbackCppToC::DebugObjCt, 0);
DCHECK_EQ(CefFocusHandlerCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefFrameCppToC::DebugObjCt, 0);
@ -230,7 +231,6 @@ CEF_EXPORT void cef_shutdown() {
DCHECK_EQ(CefStringVisitorCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefTaskCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefTaskRunnerCppToC::DebugObjCt, 0);
DCHECK_EQ(CefTraceClientCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefURLRequestClientCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefURLRequestCppToC::DebugObjCt, 0);
DCHECK_EQ(CefV8AccessorCToCpp::DebugObjCt, 0);
@ -472,36 +472,29 @@ CEF_EXPORT int cef_post_delayed_task(cef_thread_id_t threadId,
return _retval;
}
CEF_EXPORT int cef_begin_tracing(struct _cef_trace_client_t* client,
const cef_string_t* categories) {
CEF_EXPORT int cef_begin_tracing(const cef_string_t* categories) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: client, categories
// Unverified params: categories
// Execute
bool _retval = CefBeginTracing(
CefTraceClientCToCpp::Wrap(client),
CefString(categories));
// Return type: bool
return _retval;
}
CEF_EXPORT int cef_get_trace_buffer_percent_full_async() {
CEF_EXPORT int cef_end_tracing_async(const cef_string_t* tracing_file,
struct _cef_end_tracing_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
bool _retval = CefGetTraceBufferPercentFullAsync();
// Return type: bool
return _retval;
}
CEF_EXPORT int cef_end_tracing_async() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: tracing_file, callback
// Execute
bool _retval = CefEndTracingAsync();
bool _retval = CefEndTracingAsync(
CefString(tracing_file),
CefEndTracingCallbackCToCpp::Wrap(callback));
// Return type: bool
return _retval;

View File

@ -44,6 +44,7 @@
#include "libcef_dll/cpptoc/display_handler_cpptoc.h"
#include "libcef_dll/cpptoc/download_handler_cpptoc.h"
#include "libcef_dll/cpptoc/drag_handler_cpptoc.h"
#include "libcef_dll/cpptoc/end_tracing_callback_cpptoc.h"
#include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h"
#include "libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h"
@ -61,7 +62,6 @@
#include "libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h"
#include "libcef_dll/cpptoc/string_visitor_cpptoc.h"
#include "libcef_dll/cpptoc/task_cpptoc.h"
#include "libcef_dll/cpptoc/trace_client_cpptoc.h"
#include "libcef_dll/cpptoc/urlrequest_client_cpptoc.h"
#include "libcef_dll/cpptoc/v8accessor_cpptoc.h"
#include "libcef_dll/cpptoc/v8handler_cpptoc.h"
@ -193,6 +193,7 @@ CEF_GLOBAL void CefShutdown() {
DCHECK_EQ(CefDownloadItemCallbackCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefDragDataCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefDragHandlerCppToC::DebugObjCt, 0);
DCHECK_EQ(CefEndTracingCallbackCppToC::DebugObjCt, 0);
DCHECK_EQ(CefFileDialogCallbackCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefFocusHandlerCppToC::DebugObjCt, 0);
DCHECK_EQ(CefFrameCToCpp::DebugObjCt, 0);
@ -222,7 +223,6 @@ CEF_GLOBAL void CefShutdown() {
DCHECK_EQ(CefStringVisitorCppToC::DebugObjCt, 0);
DCHECK_EQ(CefTaskCppToC::DebugObjCt, 0);
DCHECK_EQ(CefTaskRunnerCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefTraceClientCppToC::DebugObjCt, 0);
DCHECK_EQ(CefURLRequestCToCpp::DebugObjCt, 0);
DCHECK_EQ(CefURLRequestClientCppToC::DebugObjCt, 0);
DCHECK_EQ(CefV8AccessorCppToC::DebugObjCt, 0);
@ -455,36 +455,29 @@ CEF_GLOBAL bool CefPostDelayedTask(CefThreadId threadId,
return _retval?true:false;
}
CEF_GLOBAL bool CefBeginTracing(CefRefPtr<CefTraceClient> client,
const CefString& categories) {
CEF_GLOBAL bool CefBeginTracing(const CefString& categories) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: client, categories
// Unverified params: categories
// Execute
int _retval = cef_begin_tracing(
CefTraceClientCppToC::Wrap(client),
categories.GetStruct());
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefGetTraceBufferPercentFullAsync() {
CEF_GLOBAL bool CefEndTracingAsync(const CefString& tracing_file,
CefRefPtr<CefEndTracingCallback> callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = cef_get_trace_buffer_percent_full_async();
// Return type: bool
return _retval?true:false;
}
CEF_GLOBAL bool CefEndTracingAsync() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: tracing_file, callback
// Execute
int _retval = cef_end_tracing_async();
int _retval = cef_end_tracing_async(
tracing_file.GetStruct(),
CefEndTracingCallbackCppToC::Wrap(callback));
// Return type: bool
return _retval?true:false;

View File

@ -57,12 +57,6 @@ patches = [
'name': 'underlay_1051',
'path': '../ui/base/cocoa/',
},
{
# Fix compile error when building without aura support on Windows.
# https://codereview.chromium.org/86313003/
'name': 'webplugin_win',
'path': '../content/child/npapi/',
},
{
# Allow specification of a parent window handle for Widget creation.
# https://code.google.com/p/chromiumembedded/issues/detail?id=180
@ -75,11 +69,25 @@ patches = [
'name': 'native_theme_180',
'path': '../ui/native_theme/',
},
{
# Allow continued use of ContentRendererClient::HandleNavigation.
# https://code.google.com/p/chromiumembedded/issues/detail?id=1129
'name': 'content_nav_1129',
'path': '../content/',
},
{
# Fix TracingController to properly track response callbacks when a
# TraceMessageFilter is removed before a response is received from
# the associated subprocess.
# https://code.google.com/p/chromiumembedded/issues/detail?id=1157
'name': 'tracing_1157',
'path': '../content/browser/tracing/',
},
{
# Disable scollbar bounce and overlay on OS X.
# http://code.google.com/p/chromiumembedded/issues/detail?id=364
'name': 'spi_webcore_364',
'path': '../third_party/WebKit/Source/core/',
'path': '../third_party/WebKit/Source/',
'condition': 'CEF_SPI_BUILD',
},
]

View File

@ -1,6 +1,6 @@
Index: common.gypi
===================================================================
--- common.gypi (revision 237081)
--- common.gypi (revision 240657)
+++ common.gypi (working copy)
@@ -9,6 +9,9 @@
# Variables expected to be overriden on the GYP command line (-D) or by
@ -12,7 +12,7 @@ Index: common.gypi
# Putting a variables dict inside another variables dict looks kind of
# weird. This is done so that 'host_arch', 'chromeos', etc are defined as
# variables within the outer variables dict here. This is necessary
@@ -186,7 +189,7 @@
@@ -201,7 +204,7 @@
'enable_app_list%': 0,
}],
@ -23,7 +23,7 @@ Index: common.gypi
'use_default_render_theme%': 0,
Index: mac/strip_save_dsym
===================================================================
--- mac/strip_save_dsym (revision 237081)
--- mac/strip_save_dsym (revision 240657)
+++ mac/strip_save_dsym (working copy)
@@ -48,7 +48,7 @@
"bundle"]

View File

@ -0,0 +1,60 @@
Index: public/renderer/content_renderer_client.cc
===================================================================
--- public/renderer/content_renderer_client.cc (revision 240657)
+++ public/renderer/content_renderer_client.cc (working copy)
@@ -91,7 +91,6 @@
return false;
}
-#ifdef OS_ANDROID
bool ContentRendererClient::HandleNavigation(
RenderView* view,
DocumentState* document_state,
@@ -103,7 +102,6 @@
bool is_redirect) {
return false;
}
-#endif
bool ContentRendererClient::ShouldFork(blink::WebFrame* frame,
const GURL& url,
Index: public/renderer/content_renderer_client.h
===================================================================
--- public/renderer/content_renderer_client.h (revision 240657)
+++ public/renderer/content_renderer_client.h (working copy)
@@ -172,7 +172,6 @@
// Returns true if a popup window should be allowed.
virtual bool AllowPopup();
-#ifdef OS_ANDROID
// TODO(sgurun) This callback is deprecated and will be removed as soon
// as android webview completes implementation of a resource throttle based
// shouldoverrideurl implementation. See crbug.com/325351
@@ -187,7 +186,6 @@
blink::WebNavigationType type,
blink::WebNavigationPolicy default_policy,
bool is_redirect);
-#endif
// Returns true if we should fork a new process for the given navigation.
// If |send_referrer| is set to false (which is the default), no referrer
Index: renderer/render_view_impl.cc
===================================================================
--- renderer/render_view_impl.cc (revision 240657)
+++ renderer/render_view_impl.cc (working copy)
@@ -3134,7 +3134,6 @@
WebFrame* frame, WebDataSource::ExtraData* extraData,
const WebURLRequest& request, WebNavigationType type,
WebNavigationPolicy default_policy, bool is_redirect) {
-#ifdef OS_ANDROID
// The handlenavigation API is deprecated and will be removed once
// crbug.com/325351 is resolved.
if (request.url() != GURL(kSwappedOutURL) &&
@@ -3149,7 +3148,6 @@
is_redirect)) {
return blink::WebNavigationPolicyIgnore;
}
-#endif
Referrer referrer(GetReferrerFromRequest(frame, request));

View File

@ -1,8 +1,8 @@
Index: frame/FrameView.cpp
Index: core/frame/FrameView.cpp
===================================================================
--- frame/FrameView.cpp (revision 161588)
+++ frame/FrameView.cpp (working copy)
@@ -201,8 +201,10 @@
--- core/frame/FrameView.cpp (revision 163979)
+++ core/frame/FrameView.cpp (working copy)
@@ -200,8 +200,10 @@
if (!isMainFrame())
return;
@ -15,7 +15,7 @@ Index: frame/FrameView.cpp
PassRefPtr<FrameView> FrameView::create(Frame* frame)
Index: platform/mac/NSScrollerImpDetails.mm
===================================================================
--- platform/mac/NSScrollerImpDetails.mm (revision 161588)
--- platform/mac/NSScrollerImpDetails.mm (revision 163979)
+++ platform/mac/NSScrollerImpDetails.mm (working copy)
@@ -73,10 +73,14 @@

View File

@ -0,0 +1,332 @@
Index: trace_message_filter.cc
===================================================================
--- trace_message_filter.cc (revision 241258)
+++ trace_message_filter.cc (working copy)
@@ -121,7 +121,7 @@
if (is_awaiting_end_ack_) {
is_awaiting_end_ack_ = false;
TracingControllerImpl::GetInstance()->OnDisableRecordingAcked(
- known_categories);
+ this, known_categories);
} else {
NOTREACHED();
}
@@ -132,7 +132,8 @@
// but check in case the child process is compromised.
if (is_awaiting_capture_monitoring_snapshot_ack_) {
is_awaiting_capture_monitoring_snapshot_ack_ = false;
- TracingControllerImpl::GetInstance()->OnCaptureMonitoringSnapshotAcked();
+ TracingControllerImpl::GetInstance()->OnCaptureMonitoringSnapshotAcked(
+ this);
} else {
NOTREACHED();
}
@@ -160,7 +161,7 @@
if (is_awaiting_buffer_percent_full_ack_) {
is_awaiting_buffer_percent_full_ack_ = false;
TracingControllerImpl::GetInstance()->OnTraceBufferPercentFullReply(
- percent_full);
+ this, percent_full);
} else {
NOTREACHED();
}
Index: tracing_controller_impl.cc
===================================================================
--- tracing_controller_impl.cc (revision 241258)
+++ tracing_controller_impl.cc (working copy)
@@ -177,7 +177,7 @@
is_recording_ = true;
// Notify all child processes.
- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
it != trace_message_filters_.end(); ++it) {
it->get()->SendBeginTracing(category_filter, trace_options);
}
@@ -212,6 +212,7 @@
// Count myself (local trace) in pending_disable_recording_ack_count_,
// acked below.
pending_disable_recording_ack_count_ = trace_message_filters_.size() + 1;
+ pending_disable_recording_filters_ = trace_message_filters_;
// Handle special case of zero child processes by immediately flushing the
// trace log. Once the flush has completed the caller will be notified that
@@ -224,7 +225,7 @@
}
// Notify all child processes.
- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
it != trace_message_filters_.end(); ++it) {
it->get()->SendEndTracing();
}
@@ -254,7 +255,7 @@
static_cast<TraceLog::Options>(monitoring_tracing_options));
// Notify all child processes.
- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
it != trace_message_filters_.end(); ++it) {
it->get()->SendEnableMonitoring(category_filter,
static_cast<TraceLog::Options>(monitoring_tracing_options));
@@ -276,7 +277,7 @@
TraceLog::GetInstance()->SetDisabled();
// Notify all child processes.
- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
it != trace_message_filters_.end(); ++it) {
it->get()->SendDisableMonitoring();
}
@@ -311,6 +312,7 @@
// acked below.
pending_capture_monitoring_snapshot_ack_count_ =
trace_message_filters_.size() + 1;
+ pending_capture_monitoring_filters_ = trace_message_filters_;
// Handle special case of zero child processes by immediately flushing the
// trace log. Once the flush has completed the caller will be notified that
@@ -323,7 +325,7 @@
}
// Notify all child processes.
- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
it != trace_message_filters_.end(); ++it) {
it->get()->SendCaptureMonitoringSnapshot();
}
@@ -347,6 +349,7 @@
// Count myself in pending_trace_buffer_percent_full_ack_count_, acked below.
pending_trace_buffer_percent_full_ack_count_ =
trace_message_filters_.size() + 1;
+ pending_trace_buffer_percent_full_filters_ = trace_message_filters_;
maximum_trace_buffer_percent_full_ = 0;
// Handle special case of zero child processes.
@@ -354,11 +357,12 @@
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply,
base::Unretained(this),
+ scoped_refptr<TraceMessageFilter>(),
TraceLog::GetInstance()->GetBufferPercentFull()));
}
// Notify all child processes.
- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
it != trace_message_filters_.end(); ++it) {
it->get()->SendGetTraceBufferPercentFull();
}
@@ -383,7 +387,7 @@
base::Bind(&TracingControllerImpl::OnWatchEventMatched,
base::Unretained(this)));
- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
it != trace_message_filters_.end(); ++it) {
it->get()->SendSetWatchEvent(category_name, event_name);
}
@@ -396,7 +400,7 @@
if (!can_cancel_watch_event())
return false;
- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin();
it != trace_message_filters_.end(); ++it) {
it->get()->SendCancelWatchEvent();
}
@@ -437,15 +441,54 @@
return;
}
+ // If a filter is removed while a response from that filter is pending then
+ // simulate the response. Otherwise the response count will be wrong and the
+ // completion callback will never be executed.
+ if (pending_disable_recording_ack_count_ > 0) {
+ TraceMessageFilterSet::const_iterator it =
+ pending_disable_recording_filters_.find(trace_message_filter);
+ if (it != pending_disable_recording_filters_.end()) {
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(&TracingControllerImpl::OnDisableRecordingAcked,
+ base::Unretained(this),
+ make_scoped_refptr(trace_message_filter),
+ std::vector<std::string>()));
+ }
+ }
+ if (pending_capture_monitoring_snapshot_ack_count_ > 0) {
+ TraceMessageFilterSet::const_iterator it =
+ pending_capture_monitoring_filters_.find(trace_message_filter);
+ if (it != pending_capture_monitoring_filters_.end()) {
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(&TracingControllerImpl::OnCaptureMonitoringSnapshotAcked,
+ base::Unretained(this),
+ make_scoped_refptr(trace_message_filter)));
+ }
+ }
+ if (pending_trace_buffer_percent_full_ack_count_ > 0) {
+ TraceMessageFilterSet::const_iterator it =
+ pending_trace_buffer_percent_full_filters_.find(trace_message_filter);
+ if (it != pending_trace_buffer_percent_full_filters_.end()) {
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply,
+ base::Unretained(this),
+ make_scoped_refptr(trace_message_filter),
+ 0));
+ }
+ }
+
trace_message_filters_.erase(trace_message_filter);
}
void TracingControllerImpl::OnDisableRecordingAcked(
+ TraceMessageFilter* trace_message_filter,
const std::vector<std::string>& known_category_groups) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&TracingControllerImpl::OnDisableRecordingAcked,
- base::Unretained(this), known_category_groups));
+ base::Unretained(this),
+ make_scoped_refptr(trace_message_filter),
+ known_category_groups));
return;
}
@@ -456,6 +499,12 @@
if (pending_disable_recording_ack_count_ == 0)
return;
+ if (trace_message_filter &&
+ !pending_disable_recording_filters_.erase(trace_message_filter)) {
+ // The response from the specified message filter has already been received.
+ return;
+ }
+
if (--pending_disable_recording_ack_count_ == 1) {
// All acks from subprocesses have been received. Now flush the local trace.
// During or after this call, our OnLocalTraceDataCollected will be
@@ -497,17 +546,25 @@
result_file_.reset();
}
-void TracingControllerImpl::OnCaptureMonitoringSnapshotAcked() {
+void TracingControllerImpl::OnCaptureMonitoringSnapshotAcked(
+ TraceMessageFilter* trace_message_filter) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&TracingControllerImpl::OnCaptureMonitoringSnapshotAcked,
- base::Unretained(this)));
+ base::Unretained(this),
+ make_scoped_refptr(trace_message_filter)));
return;
}
if (pending_capture_monitoring_snapshot_ack_count_ == 0)
return;
+ if (trace_message_filter &&
+ !pending_capture_monitoring_filters_.erase(trace_message_filter)) {
+ // The response from the specified message filter has already been received.
+ return;
+ }
+
if (--pending_capture_monitoring_snapshot_ack_count_ == 1) {
// All acks from subprocesses have been received. Now flush the local trace.
// During or after this call, our OnLocalMonitoringTraceDataCollected
@@ -582,7 +639,7 @@
// Simulate an DisableRecordingAcked for the local trace.
std::vector<std::string> category_groups;
TraceLog::GetInstance()->GetKnownCategoryGroups(&category_groups);
- OnDisableRecordingAcked(category_groups);
+ OnDisableRecordingAcked(NULL, category_groups);
}
void TracingControllerImpl::OnLocalMonitoringTraceDataCollected(
@@ -595,20 +652,30 @@
return;
// Simulate an CaptureMonitoringSnapshotAcked for the local trace.
- OnCaptureMonitoringSnapshotAcked();
+ OnCaptureMonitoringSnapshotAcked(NULL);
}
-void TracingControllerImpl::OnTraceBufferPercentFullReply(float percent_full) {
+void TracingControllerImpl::OnTraceBufferPercentFullReply(
+ TraceMessageFilter* trace_message_filter,
+ float percent_full) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply,
- base::Unretained(this), percent_full));
+ base::Unretained(this),
+ make_scoped_refptr(trace_message_filter),
+ percent_full));
return;
}
if (pending_trace_buffer_percent_full_ack_count_ == 0)
return;
+ if (trace_message_filter &&
+ !pending_trace_buffer_percent_full_filters_.erase(trace_message_filter)) {
+ // The response from the specified message filter has already been received.
+ return;
+ }
+
maximum_trace_buffer_percent_full_ =
std::max(maximum_trace_buffer_percent_full_, percent_full);
@@ -625,6 +692,7 @@
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply,
base::Unretained(this),
+ make_scoped_refptr(trace_message_filter),
TraceLog::GetInstance()->GetBufferPercentFull()));
}
}
Index: tracing_controller_impl.h
===================================================================
--- tracing_controller_impl.h (revision 241258)
+++ tracing_controller_impl.h (working copy)
@@ -55,7 +55,7 @@
virtual bool CancelWatchEvent() OVERRIDE;
private:
- typedef std::set<scoped_refptr<TraceMessageFilter> > TraceMessageFilterMap;
+ typedef std::set<scoped_refptr<TraceMessageFilter> > TraceMessageFilterSet;
class ResultFile;
friend struct base::DefaultLazyInstanceTraits<TracingControllerImpl>;
@@ -107,23 +107,30 @@
bool has_more_events);
void OnDisableRecordingAcked(
+ TraceMessageFilter* trace_message_filter,
const std::vector<std::string>& known_category_groups);
void OnResultFileClosed();
- void OnCaptureMonitoringSnapshotAcked();
+ void OnCaptureMonitoringSnapshotAcked(
+ TraceMessageFilter* trace_message_filter);
void OnMonitoringSnapshotFileClosed();
- void OnTraceBufferPercentFullReply(float percent_full);
+ void OnTraceBufferPercentFullReply(
+ TraceMessageFilter* trace_message_filter,
+ float percent_full);
void OnWatchEventMatched();
- TraceMessageFilterMap trace_message_filters_;
+ TraceMessageFilterSet trace_message_filters_;
// Pending acks for DisableRecording.
int pending_disable_recording_ack_count_;
+ TraceMessageFilterSet pending_disable_recording_filters_;
// Pending acks for CaptureMonitoringSnapshot.
int pending_capture_monitoring_snapshot_ack_count_;
+ TraceMessageFilterSet pending_capture_monitoring_filters_;
// Pending acks for GetTraceBufferPercentFull.
int pending_trace_buffer_percent_full_ack_count_;
+ TraceMessageFilterSet pending_trace_buffer_percent_full_filters_;
float maximum_trace_buffer_percent_full_;
bool is_recording_;

View File

@ -1,6 +1,6 @@
Index: desktop_aura/desktop_root_window_host_win.cc
===================================================================
--- desktop_aura/desktop_root_window_host_win.cc (revision 237081)
--- desktop_aura/desktop_root_window_host_win.cc (revision 241258)
+++ desktop_aura/desktop_root_window_host_win.cc (working copy)
@@ -131,7 +131,9 @@
native_widget_delegate_);
@ -13,9 +13,18 @@ Index: desktop_aura/desktop_root_window_host_win.cc
parent_hwnd =
params.parent->GetDispatcher()->host()->GetAcceleratedWidget();
}
@@ -751,7 +753,7 @@
void DesktopRootWindowHostWin::HandleCreate() {
// TODO(beng): moar
- NOTIMPLEMENTED();
+ // NOTIMPLEMENTED();
native_widget_delegate_->OnNativeWidgetCreated(true);
Index: desktop_aura/desktop_screen_win.cc
===================================================================
--- desktop_aura/desktop_screen_win.cc (revision 237081)
--- desktop_aura/desktop_screen_win.cc (revision 241258)
+++ desktop_aura/desktop_screen_win.cc (working copy)
@@ -54,6 +54,8 @@
}
@ -28,7 +37,7 @@ Index: desktop_aura/desktop_screen_win.cc
}
Index: widget.h
===================================================================
--- widget.h (revision 237081)
--- widget.h (revision 241258)
+++ widget.h (working copy)
@@ -201,6 +201,7 @@
// Should the widget be double buffered? Default is false.

View File

@ -1,6 +1,6 @@
Index: public/web/WebView.h
===================================================================
--- public/web/WebView.h (revision 162607)
--- public/web/WebView.h (revision 163979)
+++ public/web/WebView.h (working copy)
@@ -441,6 +441,7 @@
@ -12,9 +12,9 @@ Index: public/web/WebView.h
// Visited link state --------------------------------------------------
Index: Source/web/ChromeClientImpl.cpp
===================================================================
--- Source/web/ChromeClientImpl.cpp (revision 162607)
--- Source/web/ChromeClientImpl.cpp (revision 163979)
+++ Source/web/ChromeClientImpl.cpp (working copy)
@@ -866,7 +866,7 @@
@@ -867,7 +867,7 @@
PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(Frame& frame, PopupMenuClient* client) const
{
@ -25,9 +25,9 @@ Index: Source/web/ChromeClientImpl.cpp
return adoptRef(new PopupMenuChromium(frame, client));
Index: Source/web/WebViewImpl.cpp
===================================================================
--- Source/web/WebViewImpl.cpp (revision 162607)
--- Source/web/WebViewImpl.cpp (revision 163979)
+++ Source/web/WebViewImpl.cpp (working copy)
@@ -392,6 +392,7 @@
@@ -393,6 +393,7 @@
, m_fakePageScaleAnimationPageScaleFactor(0)
, m_fakePageScaleAnimationUseAnchor(false)
, m_contextMenuAllowed(false)
@ -35,7 +35,7 @@ Index: Source/web/WebViewImpl.cpp
, m_doingDragAndDrop(false)
, m_ignoreInputEvents(false)
, m_compositorDeviceScaleFactorOverride(0)
@@ -3686,9 +3687,14 @@
@@ -3708,9 +3709,14 @@
updateLayerTreeViewport();
}
@ -53,7 +53,7 @@ Index: Source/web/WebViewImpl.cpp
void WebViewImpl::startDragging(Frame* frame,
Index: Source/web/WebViewImpl.h
===================================================================
--- Source/web/WebViewImpl.h (revision 162607)
--- Source/web/WebViewImpl.h (revision 163979)
+++ Source/web/WebViewImpl.h (working copy)
@@ -416,7 +416,8 @@
@ -65,7 +65,7 @@ Index: Source/web/WebViewImpl.h
bool contextMenuAllowed() const
{
@@ -713,6 +714,8 @@
@@ -714,6 +715,8 @@
bool m_contextMenuAllowed;

View File

@ -1,41 +0,0 @@
Index: webplugin_delegate_impl_win.cc
===================================================================
--- webplugin_delegate_impl_win.cc (revision 237081)
+++ webplugin_delegate_impl_win.cc (working copy)
@@ -88,8 +88,10 @@
base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_proc_address =
LAZY_INSTANCE_INITIALIZER;
+#if defined(USE_AURA)
base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_window_from_point =
LAZY_INSTANCE_INITIALIZER;
+#endif
// http://crbug.com/16114
// Enforces providing a valid device context in NPWindow, so that NPP_SetWindow
@@ -420,12 +422,14 @@
GetProcAddressPatch);
}
+#if defined(USE_AURA)
if (windowless_ && !g_iat_patch_window_from_point.Pointer()->is_patched() &&
(quirks_ & PLUGIN_QUIRK_FAKE_WINDOW_FROM_POINT)) {
g_iat_patch_window_from_point.Pointer()->Patch(
GetPluginPath().value().c_str(), "user32.dll", "WindowFromPoint",
WebPluginDelegateImpl::WindowFromPointPatch);
}
+#endif
return true;
}
@@ -447,8 +451,10 @@
if (g_iat_patch_reg_enum_key_ex_w.Pointer()->is_patched())
g_iat_patch_reg_enum_key_ex_w.Pointer()->Unpatch();
+#if defined(USE_AURA)
if (g_iat_patch_window_from_point.Pointer()->is_patched())
g_iat_patch_window_from_point.Pointer()->Unpatch();
+#endif
if (mouse_hook_) {
UnhookWindowsHookEx(mouse_hook_);

View File

@ -475,8 +475,10 @@ void ClientHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
std::transform(url.begin(), url.end(), url.begin(), tolower);
std::string startupURL = GetStartupURL();
if (startupURL != "chrome://crash" && url.find(startupURL) != 0)
if (startupURL != "chrome://crash" && !url.empty() &&
url.find(startupURL) != 0) {
frame->LoadURL(startupURL);
}
}
bool ClientHandler::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
@ -616,54 +618,7 @@ void ClientHandler::CloseDevTools(CefRefPtr<CefBrowser> browser) {
void ClientHandler::BeginTracing() {
if (CefCurrentlyOn(TID_UI)) {
class Client : public CefTraceClient,
public CefRunFileDialogCallback {
public:
explicit Client(CefRefPtr<ClientHandler> handler)
: handler_(handler),
trace_data_("{\"traceEvents\":["),
first_(true) {
}
virtual void OnTraceDataCollected(const char* fragment,
size_t fragment_size) OVERRIDE {
if (first_)
first_ = false;
else
trace_data_.append(",");
trace_data_.append(fragment, fragment_size);
}
virtual void OnEndTracingComplete() OVERRIDE {
REQUIRE_UI_THREAD();
trace_data_.append("]}");
static const char kDefaultFileName[] = "trace.txt";
std::string path = handler_->GetDownloadPath(kDefaultFileName);
if (path.empty())
path = kDefaultFileName;
handler_->GetBrowser()->GetHost()->RunFileDialog(
FILE_DIALOG_SAVE, CefString(), path, std::vector<CefString>(),
this);
}
virtual void OnFileDialogDismissed(
CefRefPtr<CefBrowserHost> browser_host,
const std::vector<CefString>& file_paths) OVERRIDE {
if (!file_paths.empty())
handler_->Save(file_paths.front(), trace_data_);
}
private:
CefRefPtr<ClientHandler> handler_;
std::string trace_data_;
bool first_;
IMPLEMENT_REFCOUNTING(Callback);
};
CefBeginTracing(new Client(this), CefString());
CefBeginTracing(CefString());
} else {
CefPostTask(TID_UI,
NewCefRunnableMethod(this, &ClientHandler::BeginTracing));
@ -672,7 +627,50 @@ void ClientHandler::BeginTracing() {
void ClientHandler::EndTracing() {
if (CefCurrentlyOn(TID_UI)) {
CefEndTracingAsync();
class Client : public CefEndTracingCallback,
public CefRunFileDialogCallback {
public:
explicit Client(CefRefPtr<ClientHandler> handler)
: handler_(handler) {
RunDialog();
}
void RunDialog() {
static const char kDefaultFileName[] = "trace.txt";
std::string path = handler_->GetDownloadPath(kDefaultFileName);
if (path.empty())
path = kDefaultFileName;
// Results in a call to OnFileDialogDismissed.
handler_->GetBrowser()->GetHost()->RunFileDialog(
FILE_DIALOG_SAVE, CefString(), path, std::vector<CefString>(),
this);
}
virtual void OnFileDialogDismissed(
CefRefPtr<CefBrowserHost> browser_host,
const std::vector<CefString>& file_paths) OVERRIDE {
if (!file_paths.empty()) {
// File selected. Results in a call to OnEndTracingComplete.
CefEndTracingAsync(file_paths.front(), this);
} else {
// No file selected. Discard the trace data.
CefEndTracingAsync(CefString(), NULL);
}
}
virtual void OnEndTracingComplete(const CefString& tracing_file) OVERRIDE {
handler_->SetLastDownloadFile(tracing_file.ToString());
handler_->SendNotification(NOTIFY_DOWNLOAD_COMPLETE);
}
private:
CefRefPtr<ClientHandler> handler_;
IMPLEMENT_REFCOUNTING(Callback);
};
new Client(this);
} else {
CefPostTask(TID_UI,
NewCefRunnableMethod(this, &ClientHandler::BeginTracing));

View File

@ -2,7 +2,9 @@
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "base/file_util.h"
#include "base/synchronization/waitable_event.h"
#include "include/cef_runnable.h"
#include "include/cef_task.h"
#include "include/cef_trace.h"
#include "include/cef_trace_event.h"
@ -63,41 +65,7 @@ enum TracingTestType {
const char kTraceTestCategory[] = "test_category";
// Used to test begin tracing on the UI thread.
class BeginTracingTask : public CefTask {
public:
explicit BeginTracingTask(CefRefPtr<CefTraceClient> client)
: client_(client) {
}
virtual void Execute() OVERRIDE {
EXPECT_TRUE(CefBeginTracing(client_, kTraceTestCategory));
}
private:
virtual ~BeginTracingTask() {}
CefRefPtr<CefTraceClient> client_;
IMPLEMENT_REFCOUNTING(BeginTracingTask);
};
// Used to test end tracing on the UI thread.
class EndTracingTask : public CefTask {
public:
EndTracingTask() {}
virtual void Execute() OVERRIDE {
EXPECT_TRUE(CefEndTracingAsync());
}
private:
virtual ~EndTracingTask() {}
IMPLEMENT_REFCOUNTING(EndTracingTask);
};
class TracingTestHandler : public CefTraceClient {
class TracingTestHandler : public CefEndTracingCallback {
public:
TracingTestHandler(TracingTestType type, const char* trace_type)
: completion_event_(true, false),
@ -105,24 +73,29 @@ class TracingTestHandler : public CefTraceClient {
type_(type) {
}
virtual void OnTraceDataCollected(const char* fragment,
size_t fragment_size) OVERRIDE {
if (!trace_data_.empty())
trace_data_.append(",");
trace_data_.append(fragment, fragment_size);
}
void ReadTracingFile(const base::FilePath& file_path) {
EXPECT_TRUE(CefCurrentlyOn(TID_FILE));
base::ReadFileToString(file_path, &trace_data_);
base::DeleteFile(file_path, false);
virtual void OnEndTracingComplete() OVERRIDE {
EXPECT_TRUE(!trace_data_.empty());
EXPECT_TRUE(trace_type_ != NULL);
EXPECT_TRUE(strstr(trace_data_.c_str(), trace_type_) != NULL);
completion_event_.Signal();
}
void RunTest() {
// BeginTracing works only on the UI thread.
CefPostTask(TID_UI, new BeginTracingTask(this));
WaitForUIThread();
// CefEndTracingCallback method:
virtual void OnEndTracingComplete(const CefString& tracing_file) OVERRIDE {
EXPECT_TRUE(CefCurrentlyOn(TID_UI));
base::FilePath file_path(tracing_file);
CefPostTask(TID_FILE,
NewCefRunnableMethod(this, &TracingTestHandler::ReadTracingFile,
file_path));
}
void RunTracing() {
EXPECT_TRUE(CefCurrentlyOn(TID_UI));
CefBeginTracing(kTraceTestCategory);
switch (type_) {
case CEF_TRACE_EVENT0: {
@ -339,17 +312,22 @@ class TracingTestHandler : public CefTraceClient {
break;
}
// Run EndTracingAsync on the UI thread.
CefPostTask(TID_UI, new EndTracingTask());
WaitForUIThread();
// Results in a call to OnEndTracingComplete.
CefEndTracingAsync(CefString(), this);
}
void ExecuteTest() {
// Run the test.
RunTest();
CefPostTask(TID_UI,
NewCefRunnableMethod(this, &TracingTestHandler::RunTracing));
// Wait for the test to complete.
completion_event_.Wait();
// Verify the results.
EXPECT_TRUE(!trace_data_.empty());
EXPECT_TRUE(trace_type_ != NULL);
EXPECT_TRUE(strstr(trace_data_.c_str(), trace_type_) != NULL);
}
private: