| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ | 5 #ifndef CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ |
| 6 #define CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ | 6 #define CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "content/child/npapi/np_channel_base.h" | 12 #include "content/child/npapi/np_channel_base.h" |
| 13 #include "content/child/scoped_child_process_reference.h" | 13 #include "content/child/scoped_child_process_reference.h" |
| 14 #include "content/plugin/webplugin_delegate_stub.h" | 14 #include "content/plugin/webplugin_delegate_stub.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class WaitableEvent; | 17 class WaitableEvent; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 // Encapsulates an IPC channel between the plugin process and one renderer | 22 // Encapsulates an IPC channel between the plugin process and one renderer |
| 23 // process. On the renderer side there's a corresponding PluginChannelHost. | 23 // process. On the renderer side there's a corresponding PluginChannelHost. |
| 24 class PluginChannel : public NPChannelBase { | 24 class PluginChannel : public NPChannelBase { |
| 25 public: | 25 public: |
| 26 // Get a new PluginChannel object for the current process to talk to the | 26 // Get a new PluginChannel object for the current process to talk to the |
| 27 // given renderer process. The renderer ID is an opaque unique ID generated | 27 // given renderer process. The renderer ID is an opaque unique ID generated |
| 28 // by the browser. | 28 // by the browser. |
| 29 static PluginChannel* GetPluginChannel( | 29 static PluginChannel* GetPluginChannel( |
| 30 int renderer_id, base::SingleThreadTaskRunner* ipc_task_runner); | 30 int renderer_id, |
| 31 base::SingleThreadTaskRunner* ipc_task_runner, |
| 32 IPC::AttachmentBroker* broker); |
| 31 | 33 |
| 32 // Send a message to all renderers that the process is going to shutdown. | 34 // Send a message to all renderers that the process is going to shutdown. |
| 33 static void NotifyRenderersOfPendingShutdown(); | 35 static void NotifyRenderersOfPendingShutdown(); |
| 34 | 36 |
| 35 // IPC::Listener: | 37 // IPC::Listener: |
| 36 bool Send(IPC::Message* msg) override; | 38 bool Send(IPC::Message* msg) override; |
| 37 bool OnMessageReceived(const IPC::Message& message) override; | 39 bool OnMessageReceived(const IPC::Message& message) override; |
| 38 void OnChannelError() override; | 40 void OnChannelError() override; |
| 39 | 41 |
| 40 int renderer_id() { return renderer_id_; } | 42 int renderer_id() { return renderer_id_; } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 56 } | 58 } |
| 57 #endif | 59 #endif |
| 58 | 60 |
| 59 protected: | 61 protected: |
| 60 ~PluginChannel() override; | 62 ~PluginChannel() override; |
| 61 | 63 |
| 62 // NPChannelBase:: | 64 // NPChannelBase:: |
| 63 void CleanUp() override; | 65 void CleanUp() override; |
| 64 bool Init(base::SingleThreadTaskRunner* ipc_task_runner, | 66 bool Init(base::SingleThreadTaskRunner* ipc_task_runner, |
| 65 bool create_pipe_now, | 67 bool create_pipe_now, |
| 66 base::WaitableEvent* shutdown_event) override; | 68 base::WaitableEvent* shutdown_event, |
| 69 IPC::AttachmentBroker* broker) override; |
| 67 | 70 |
| 68 private: | 71 private: |
| 69 class MessageFilter; | 72 class MessageFilter; |
| 70 | 73 |
| 71 // Called on the plugin thread | 74 // Called on the plugin thread |
| 72 PluginChannel(); | 75 PluginChannel(); |
| 73 | 76 |
| 74 bool OnControlMessageReceived(const IPC::Message& msg) override; | 77 bool OnControlMessageReceived(const IPC::Message& msg) override; |
| 75 | 78 |
| 76 static NPChannelBase* ClassFactory() { return new PluginChannel(); } | 79 static NPChannelBase* ClassFactory() { return new PluginChannel(); } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 98 // Dummy NPP value used in the plugin process to represent entities other | 101 // Dummy NPP value used in the plugin process to represent entities other |
| 99 // that other plugin instances for the purpose of object ownership tracking. | 102 // that other plugin instances for the purpose of object ownership tracking. |
| 100 scoped_ptr<struct _NPP> npp_; | 103 scoped_ptr<struct _NPP> npp_; |
| 101 | 104 |
| 102 DISALLOW_COPY_AND_ASSIGN(PluginChannel); | 105 DISALLOW_COPY_AND_ASSIGN(PluginChannel); |
| 103 }; | 106 }; |
| 104 | 107 |
| 105 } // namespace content | 108 } // namespace content |
| 106 | 109 |
| 107 #endif // CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ | 110 #endif // CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ |
| OLD | NEW |