mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Convert legacy IPC messages to Mojo (fixes issue #3123)
This change introduces a few minor CEF API behavior changes: - A CefProcessMessage object cannot be reused after being passed to SendProcessMessage. - The |extra_info| argument to CefRenderProcessHandler::OnBrowserCreated may now be NULL. Where appropriate, we now utilize the default UTF string encoding format and shared memory to reduce copies and conversions for the cross-process transfer of arbitrary-length strings. For example, CefFrame::GetSource/GetText now involves zero UTF conversions and zero copies in the browser process for the CefString delivered to CefStringVisitor::Visit().
This commit is contained in:
@@ -7,20 +7,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_process_message.h"
|
||||
#include "libcef/common/value_base.h"
|
||||
|
||||
struct Cef_Request_Params;
|
||||
namespace base {
|
||||
class ListValue;
|
||||
}
|
||||
|
||||
// CefProcessMessage implementation
|
||||
class CefProcessMessageImpl
|
||||
: public CefValueBase<CefProcessMessage, Cef_Request_Params> {
|
||||
// CefProcessMessage implementation.
|
||||
class CefProcessMessageImpl : public CefProcessMessage {
|
||||
public:
|
||||
CefProcessMessageImpl(Cef_Request_Params* value,
|
||||
bool will_delete,
|
||||
// Constructor for an owned list of arguments.
|
||||
CefProcessMessageImpl(const CefString& name,
|
||||
CefRefPtr<CefListValue> arguments);
|
||||
|
||||
// Constructor for an unowned list of arguments.
|
||||
// Call Detach() when |arguments| is no longer valid.
|
||||
CefProcessMessageImpl(const CefString& name,
|
||||
base::ListValue* arguments,
|
||||
bool read_only);
|
||||
|
||||
// Copies the underlying value to the specified |target| structure.
|
||||
bool CopyTo(Cef_Request_Params& target);
|
||||
~CefProcessMessageImpl() override;
|
||||
|
||||
// Stop referencing the underlying argument list (which we never owned).
|
||||
void Detach();
|
||||
|
||||
// Transfer ownership of the underlying argument list to the caller.
|
||||
// TODO: Pass by reference instead of ownership if/when Mojo adds support
|
||||
// for that.
|
||||
base::ListValue TakeArgumentList() WARN_UNUSED_RESULT;
|
||||
|
||||
// CefProcessMessage methods.
|
||||
bool IsValid() override;
|
||||
@@ -29,6 +42,12 @@ class CefProcessMessageImpl
|
||||
CefString GetName() override;
|
||||
CefRefPtr<CefListValue> GetArgumentList() override;
|
||||
|
||||
private:
|
||||
const CefString name_;
|
||||
CefRefPtr<CefListValue> arguments_;
|
||||
const bool should_detach_ = false;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefProcessMessageImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefProcessMessageImpl);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user