OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_RENDERER_PEPPER_HOST_DISPATCHER_WRAPPER_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_HOST_DISPATCHER_WRAPPER_H_ |
6 #define CONTENT_RENDERER_PEPPER_HOST_DISPATCHER_WRAPPER_H_ | 6 #define CONTENT_RENDERER_PEPPER_HOST_DISPATCHER_WRAPPER_H_ |
7 | 7 |
| 8 #include "base/memory/ref_counted.h" |
8 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
| 10 #include "content/renderer/pepper/pepper_hung_plugin_filter.h" |
9 #include "ppapi/c/pp_instance.h" | 11 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/ppp.h" | 12 #include "ppapi/c/ppp.h" |
11 #include "ppapi/proxy/host_dispatcher.h" | 13 #include "ppapi/proxy/host_dispatcher.h" |
12 #include "ppapi/shared_impl/ppapi_permissions.h" | 14 #include "ppapi/shared_impl/ppapi_permissions.h" |
13 | 15 |
14 namespace IPC { | 16 namespace IPC { |
15 struct ChannelHandle; | 17 struct ChannelHandle; |
16 } | 18 } |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 class PepperHungPluginFilter; | 21 class PepperHungPluginFilter; |
20 class PluginModule; | 22 class PluginModule; |
21 | 23 |
22 // This class wraps a dispatcher and has the same lifetime. A dispatcher has | 24 // This class wraps a dispatcher and has the same lifetime. A dispatcher has |
23 // the same lifetime as a plugin module, which is longer than any particular | 25 // the same lifetime as a plugin module, which is longer than any particular |
24 // RenderView or plugin instance. | 26 // RenderView or plugin instance. |
25 class HostDispatcherWrapper { | 27 class HostDispatcherWrapper { |
26 public: | 28 public: |
27 HostDispatcherWrapper(PluginModule* module, | 29 HostDispatcherWrapper(PluginModule* module, |
28 base::ProcessId peer_pid, | 30 base::ProcessId peer_pid, |
29 int plugin_child_id, | 31 int plugin_child_id, |
30 const ppapi::PpapiPermissions& perms, | 32 const ppapi::PpapiPermissions& perms, |
31 bool is_external); | 33 bool is_external); |
32 virtual ~HostDispatcherWrapper(); | 34 virtual ~HostDispatcherWrapper(); |
33 | 35 |
34 bool Init(const IPC::ChannelHandle& channel_handle, | 36 bool Init(const IPC::ChannelHandle& channel_handle, |
35 PP_GetInterface_Func local_get_interface, | 37 PP_GetInterface_Func local_get_interface, |
36 const ppapi::Preferences& preferences, | 38 const ppapi::Preferences& preferences, |
37 PepperHungPluginFilter* filter); | 39 scoped_refptr<PepperHungPluginFilter> filter); |
38 | 40 |
39 // Implements GetInterface for the proxied plugin. | 41 // Implements GetInterface for the proxied plugin. |
40 const void* GetProxiedInterface(const char* name); | 42 const void* GetProxiedInterface(const char* name); |
41 | 43 |
42 // Notification to the out-of-process layer that the given plugin instance | 44 // Notification to the out-of-process layer that the given plugin instance |
43 // has been created. This will happen before the normal PPB_Instance method | 45 // has been created. This will happen before the normal PPB_Instance method |
44 // calls so the out-of-process code can set up the tracking information for | 46 // calls so the out-of-process code can set up the tracking information for |
45 // the new instance. | 47 // the new instance. |
46 void AddInstance(PP_Instance instance); | 48 void AddInstance(PP_Instance instance); |
47 | 49 |
(...skipping 14 matching lines...) Expand all Loading... |
62 // ID that the browser process uses to idetify the child process for the | 64 // ID that the browser process uses to idetify the child process for the |
63 // plugin. This isn't directly useful from our process (the renderer) except | 65 // plugin. This isn't directly useful from our process (the renderer) except |
64 // in messages to the browser to disambiguate plugins. | 66 // in messages to the browser to disambiguate plugins. |
65 int plugin_child_id_; | 67 int plugin_child_id_; |
66 | 68 |
67 ppapi::PpapiPermissions permissions_; | 69 ppapi::PpapiPermissions permissions_; |
68 bool is_external_; | 70 bool is_external_; |
69 | 71 |
70 scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_; | 72 scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_; |
71 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; | 73 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; |
| 74 // We hold the hung_plugin_filter_ to guarantee it outlives |dispatcher_|, |
| 75 // since it is an observer of |dispatcher_| for sync calls. |
| 76 scoped_refptr<PepperHungPluginFilter> hung_plugin_filter_; |
72 }; | 77 }; |
73 | 78 |
74 } // namespace content | 79 } // namespace content |
75 | 80 |
76 #endif // CONTENT_RENDERER_PEPPER_HOST_DISPATCHER_WRAPPER_H_ | 81 #endif // CONTENT_RENDERER_PEPPER_HOST_DISPATCHER_WRAPPER_H_ |
OLD | NEW |