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_RENDERER_PEPPER_PEPPER_HUNG_PLUGIN_FILTER_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_HUNG_PLUGIN_FILTER_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_HUNG_PLUGIN_FILTER_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_HUNG_PLUGIN_FILTER_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "ipc/ipc_channel_proxy.h" | 12 #include "ipc/ipc_channel_proxy.h" |
13 #include "ipc/ipc_sync_message_filter.h" | 13 #include "ipc/ipc_sync_message_filter.h" |
14 #include "ppapi/proxy/host_dispatcher.h" | 14 #include "ppapi/proxy/host_dispatcher.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 // This class monitors a renderer <-> pepper plugin channel on the I/O thread | 18 // This class monitors a renderer <-> pepper plugin channel on the I/O thread |
19 // of the renderer for a hung plugin. | 19 // of the renderer for a hung plugin. |
20 // | 20 // |
21 // If the plugin is not responding to sync messages, it will notify the browser | 21 // If the plugin is not responding to sync messages, it will notify the browser |
22 // process and give the user the option to kill the hung plugin. | 22 // process and give the user the option to kill the hung plugin. |
23 // | 23 // |
24 // Note that this class must be threadsafe since it will get the begin/end | 24 // Note that this class must be threadsafe since it will get the begin/end |
25 // block notifications on the main thread, but the filter is run on the I/O | 25 // block notifications on the main thread, but the filter is run on the I/O |
26 // thread. This is important since when we're blocked on a sync message to a | 26 // thread. This is important since when we're blocked on a sync message to a |
27 // hung plugin, the main thread is frozen. | 27 // hung plugin, the main thread is frozen. |
28 // | 28 // |
29 // NOTE: This class is refcounted (via SyncMessageStatusReceiver). | 29 // NOTE: This class is refcounted (via IPC::MessageFilter). |
30 class PepperHungPluginFilter | 30 class PepperHungPluginFilter |
31 : public ppapi::proxy::HostDispatcher::SyncMessageStatusReceiver { | 31 : public ppapi::proxy::HostDispatcher::SyncMessageStatusObserver, |
| 32 public IPC::MessageFilter { |
32 public: | 33 public: |
33 // The |frame_routing_id| is the ID of the render_frame so that this class can | 34 // The |frame_routing_id| is the ID of the render_frame so that this class can |
34 // send messages to the browser via that frame's route. The |plugin_child_id| | 35 // send messages to the browser via that frame's route. The |plugin_child_id| |
35 // is the ID in the browser process of the pepper plugin process host. We use | 36 // is the ID in the browser process of the pepper plugin process host. We use |
36 // this to identify the proper plugin process to terminate. | 37 // this to identify the proper plugin process to terminate. |
37 PepperHungPluginFilter(const base::FilePath& plugin_path, | 38 PepperHungPluginFilter(const base::FilePath& plugin_path, |
38 int frame_routing_id, | 39 int frame_routing_id, |
39 int plugin_child_id); | 40 int plugin_child_id); |
40 | 41 |
41 // SyncMessageStatusReceiver implementation. | 42 // SyncMessageStatusReceiver implementation. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool hung_plugin_showing_; | 106 bool hung_plugin_showing_; |
106 | 107 |
107 bool timer_task_pending_; | 108 bool timer_task_pending_; |
108 | 109 |
109 DISALLOW_COPY_AND_ASSIGN(PepperHungPluginFilter); | 110 DISALLOW_COPY_AND_ASSIGN(PepperHungPluginFilter); |
110 }; | 111 }; |
111 | 112 |
112 } // namespace content | 113 } // namespace content |
113 | 114 |
114 #endif // CONTENT_RENDERER_PEPPER_PEPPER_HUNG_PLUGIN_FILTER_H_ | 115 #endif // CONTENT_RENDERER_PEPPER_PEPPER_HUNG_PLUGIN_FILTER_H_ |
OLD | NEW |