| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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, | 30 int renderer_id, |
| 31 base::SingleThreadTaskRunner* ipc_task_runner, | 31 base::SingleThreadTaskRunner* ipc_task_runner); |
| 32 IPC::AttachmentBroker* broker); | |
| 33 | 32 |
| 34 // Send a message to all renderers that the process is going to shutdown. | 33 // Send a message to all renderers that the process is going to shutdown. |
| 35 static void NotifyRenderersOfPendingShutdown(); | 34 static void NotifyRenderersOfPendingShutdown(); |
| 36 | 35 |
| 37 // IPC::Listener: | 36 // IPC::Listener: |
| 38 bool Send(IPC::Message* msg) override; | 37 bool Send(IPC::Message* msg) override; |
| 39 bool OnMessageReceived(const IPC::Message& message) override; | 38 bool OnMessageReceived(const IPC::Message& message) override; |
| 40 void OnChannelError() override; | 39 void OnChannelError() override; |
| 41 | 40 |
| 42 int renderer_id() { return renderer_id_; } | 41 int renderer_id() { return renderer_id_; } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 58 } | 57 } |
| 59 #endif | 58 #endif |
| 60 | 59 |
| 61 protected: | 60 protected: |
| 62 ~PluginChannel() override; | 61 ~PluginChannel() override; |
| 63 | 62 |
| 64 // NPChannelBase:: | 63 // NPChannelBase:: |
| 65 void CleanUp() override; | 64 void CleanUp() override; |
| 66 bool Init(base::SingleThreadTaskRunner* ipc_task_runner, | 65 bool Init(base::SingleThreadTaskRunner* ipc_task_runner, |
| 67 bool create_pipe_now, | 66 bool create_pipe_now, |
| 68 base::WaitableEvent* shutdown_event, | 67 base::WaitableEvent* shutdown_event) override; |
| 69 IPC::AttachmentBroker* broker) override; | |
| 70 | 68 |
| 71 private: | 69 private: |
| 72 class MessageFilter; | 70 class MessageFilter; |
| 73 | 71 |
| 74 // Called on the plugin thread | 72 // Called on the plugin thread |
| 75 PluginChannel(); | 73 PluginChannel(); |
| 76 | 74 |
| 77 bool OnControlMessageReceived(const IPC::Message& msg) override; | 75 bool OnControlMessageReceived(const IPC::Message& msg) override; |
| 78 | 76 |
| 79 static NPChannelBase* ClassFactory() { return new PluginChannel(); } | 77 static NPChannelBase* ClassFactory() { return new PluginChannel(); } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 101 // Dummy NPP value used in the plugin process to represent entities other | 99 // Dummy NPP value used in the plugin process to represent entities other |
| 102 // that other plugin instances for the purpose of object ownership tracking. | 100 // that other plugin instances for the purpose of object ownership tracking. |
| 103 scoped_ptr<struct _NPP> npp_; | 101 scoped_ptr<struct _NPP> npp_; |
| 104 | 102 |
| 105 DISALLOW_COPY_AND_ASSIGN(PluginChannel); | 103 DISALLOW_COPY_AND_ASSIGN(PluginChannel); |
| 106 }; | 104 }; |
| 107 | 105 |
| 108 } // namespace content | 106 } // namespace content |
| 109 | 107 |
| 110 #endif // CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ | 108 #endif // CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ |
| OLD | NEW |