diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-18 22:31:09 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-18 22:31:09 +0000 |
commit | d259a8ecab95cd657b9c7d413e8bfa3c86d0d4cb (patch) | |
tree | 83805324a9ffeeb10b334d544b13155c8c52b069 /ppapi/proxy/plugin_dispatcher.h | |
parent | 772b57ab0dcd7843157b961f10999e48088e8973 (diff) | |
download | chromium_src-d259a8ecab95cd657b9c7d413e8bfa3c86d0d4cb.zip chromium_src-d259a8ecab95cd657b9c7d413e8bfa3c86d0d4cb.tar.gz chromium_src-d259a8ecab95cd657b9c7d413e8bfa3c86d0d4cb.tar.bz2 |
Support getting the font list in Pepper. This currently only works out of
process.
This adds a function to the font interface to get the font list. Since we
don't have arrays or dictionaries in Pepper yet, I used a string with nulls
separating the names. A previous attempt to make a "font list resource" proved
excessively complicated and not actually much easier for clients to deal with.
This refactors the existing font list getting that used to be in the options
for the browser. I moved it to content and split it into two pieces, the
synchronous version, and then an asynchronous wrapper around that which both
the prefs code and the pepper code use. This cleaned up some of the preferences
code, and also fixes the leak of the entire font list in the code.
I used the new callback/bind system for the async font loading. I had to add
BrowserThread support for the new system.
This uses the PepperMessageFilter to listen for font load requests from the
plugin in the browser process. This is nice because we can add stuff here and
have messages serviced for both in-process and out-of-process plugins. This
proved to be complicated due to the HostResolver used in some of the existing
code, and thread restrictions for how to deal with it. This is why there are
two modes for the filter object.
I changed the delegates around for the Dispatcher. Now the PluginDispatcher
has the delegate interface since the HostDispatcher didn't actually need any
of them and we were accumulating a lot of empty functions in the
PepperPluginRegistry.
It's possible for the fonts to be loaded on Windows and Mac without IPC, since
enumerating fonts should be possible inside the sandbox. I didn't implement
this since it adds extra complexity and probably doesn't give that much
benefit.
TEST=manual
BUG=none
Review URL: http://codereview.chromium.org/7044012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85827 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/plugin_dispatcher.h')
-rw-r--r-- | ppapi/proxy/plugin_dispatcher.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h index 65c4c82..29460fa 100644 --- a/ppapi/proxy/plugin_dispatcher.h +++ b/ppapi/proxy/plugin_dispatcher.h @@ -34,6 +34,29 @@ struct InstanceData { class PluginDispatcher : public Dispatcher { public: + class PluginDelegate : public ProxyChannel::Delegate { + public: + // Returns the set used for globally uniquifying PP_Instances. This same + // set must be returned for all channels. + // + // DEREFERENCE ONLY ON THE I/O THREAD. + virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() = 0; + + // Returns the WebKit forwarding object used to make calls into WebKit. + // Necessary only on the plugin side. + virtual ppapi::WebKitForwarding* GetWebKitForwarding() = 0; + + // Posts the given task to the WebKit thread associated with this plugin + // process. The WebKit thread should be lazily created if it does not + // exist yet. + virtual void PostToWebKitThread(const tracked_objects::Location& from_here, + const base::Closure& task) = 0; + + // Sends the given message to the browser. Identical semantics to + // IPC::Message::Sender interface. + virtual bool SendToBrowser(IPC::Message* msg) = 0; + }; + // Constructor for the plugin side. The init and shutdown functions will be // will be automatically called when requested by the renderer side. The // module ID will be set upon receipt of the InitializeModule message. @@ -54,9 +77,9 @@ class PluginDispatcher : public Dispatcher { // You must call this function before anything else. Returns true on success. // The delegate pointer must outlive this class, ownership is not // transferred. - virtual bool InitPluginWithChannel(Dispatcher::Delegate* delegate, - const IPC::ChannelHandle& channel_handle, - bool is_client); + bool InitPluginWithChannel(PluginDelegate* delegate, + const IPC::ChannelHandle& channel_handle, + bool is_client); // Dispatcher overrides. virtual bool IsPlugin() const; @@ -79,6 +102,9 @@ class PluginDispatcher : public Dispatcher { void PostToWebKitThread(const tracked_objects::Location& from_here, const base::Closure& task); + // Calls the PluginDelegate.SendToBrowser function. + bool SendToBrowser(IPC::Message* msg); + // Returns the WebKitForwarding object used to forward events to WebKit. ppapi::WebKitForwarding* GetWebKitForwarding(); @@ -99,6 +125,8 @@ class PluginDispatcher : public Dispatcher { // IPC message handlers. void OnMsgSupportsInterface(const std::string& interface_name, bool* result); + PluginDelegate* plugin_delegate_; + // All target proxies currently created. These are ones that receive // messages. scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; |