OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "ppapi/proxy/connection.h" |
| 8 |
| 9 namespace content { |
| 10 |
| 11 class RendererPpapiHostImpl; |
| 12 |
| 13 // This class fakes an IPC channel so that we can take the new resources with |
| 14 // IPC backends and run them in-process. |
| 15 // |
| 16 // (See pepper_in_process_resource_creation.h for more background.) |
| 17 // |
| 18 // This class just provides the fake routing for in-process plugins. |
| 19 // Asynchronous messages are converted into an asynchronous execution of the |
| 20 // message receiver on the opposite end. Synchronous messages just call right |
| 21 // through. |
| 22 // |
| 23 // The resources in ppapi/proxy assume that there is an IPC connection to |
| 24 // both the renderer and the browser processes. They take a connection object |
| 25 // that includes both of these channels. However, in-process plugins don't |
| 26 // have a BrowserPpapiHost on the browser side to receive these messages. |
| 27 // |
| 28 // As a result, we can't support resources that rely on sending messages to the |
| 29 // browser process. Since this class is a stopgap until all interfaces are |
| 30 // converted and all plugins are run out-of-procss, we just choose not to |
| 31 // support faking IPC channels for resources that send messages directly to the |
| 32 // browser process. These resources will just have to use the "old" in-process |
| 33 // implementation until the conversion is complete and all this code can be |
| 34 // deleted. |
| 35 // |
| 36 // To keep things consistent, we provide an IPC::Sender for the browser channel |
| 37 // in the connection object supplied to resources. This dummy browser channel |
| 38 // will just assert and delete the message if anything is ever sent over it. |
| 39 class PepperInProcessRouter { |
| 40 public: |
| 41 // The given host parameter owns this class and must outlive us. |
| 42 PepperInProcessRouter(RendererPpapiHostImpl* host_impl); |
| 43 ~PepperInProcessRouter(); |
| 44 |
| 45 // Returns the dummy sender for the cooresponding end of the in-process |
| 46 // emulated channel. |
| 47 IPC::Sender* GetPluginToRendererSender(); |
| 48 IPC::Sender* GetRendererToPluginSender(); |
| 49 |
| 50 // Returns a connection pair for use by a resource proxy. This includes |
| 51 // the plugin->renderer sender as well as a dummy sender to the browser |
| 52 // process. See the class comment above about the dummy sender. |
| 53 ppapi::proxy::Connection GetPluginConnection(); |
| 54 |
| 55 private: |
| 56 class DummyBrowserChannel; |
| 57 scoped_ptr<DummyBrowserChannel> dummy_browser_channel_; |
| 58 |
| 59 // Renderer -> plugin channel. |
| 60 class HostToPluginRouter; |
| 61 scoped_ptr<HostToPluginRouter> host_to_plugin_router_; |
| 62 |
| 63 // Plugin -> renderer channel. |
| 64 class PluginToHostRouter; |
| 65 scoped_ptr<PluginToHostRouter> plugin_to_host_router_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(PepperInProcessRouter); |
| 68 }; |
| 69 |
| 70 } // namespace content |
OLD | NEW |