OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_PLUGIN_PLUGIN_CHANNEL_BASE_H_ | 5 #ifndef CHROME_PLUGIN_PLUGIN_CHANNEL_BASE_H_ |
6 #define CHROME_PLUGIN_PLUGIN_CHANNEL_BASE_H_ | 6 #define CHROME_PLUGIN_PLUGIN_CHANNEL_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/mp/message_router.h" |
13 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
14 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
15 #include "chrome/common/message_router.h" | |
16 #include "chrome/plugin/npobject_base.h" | 16 #include "chrome/plugin/npobject_base.h" |
17 #include "gfx/native_widget_types.h" | 17 #include "gfx/native_widget_types.h" |
18 #include "ipc/ipc_sync_channel.h" | 18 #include "ipc/ipc_sync_channel.h" |
19 | 19 |
20 // Encapsulates an IPC channel between a renderer and a plugin process. | 20 // Encapsulates an IPC channel between a renderer and a plugin process. |
21 class PluginChannelBase : public IPC::Channel::Listener, | 21 class PluginChannelBase : public IPC::Channel::Listener, |
22 public IPC::Message::Sender, | 22 public IPC::Message::Sender, |
23 public base::RefCountedThreadSafe<PluginChannelBase> { | 23 public base::RefCountedThreadSafe<PluginChannelBase> { |
24 public: | 24 public: |
25 | 25 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // true when in the middle of a RemoveRoute call | 111 // true when in the middle of a RemoveRoute call |
112 bool in_remove_route_; | 112 bool in_remove_route_; |
113 | 113 |
114 // Keep track of all the registered NPObjects proxies/stubs so that when the | 114 // Keep track of all the registered NPObjects proxies/stubs so that when the |
115 // channel is closed we can inform them. | 115 // channel is closed we can inform them. |
116 typedef base::hash_map<int, NPObjectBase*> ListenerMap; | 116 typedef base::hash_map<int, NPObjectBase*> ListenerMap; |
117 ListenerMap npobject_listeners_; | 117 ListenerMap npobject_listeners_; |
118 | 118 |
119 // Used to implement message routing functionality to WebPlugin[Delegate] | 119 // Used to implement message routing functionality to WebPlugin[Delegate] |
120 // objects | 120 // objects |
121 MessageRouter router_; | 121 base::MessageRouter router_; |
122 | 122 |
123 // A channel is invalid if it is disconnected as a result of a channel | 123 // A channel is invalid if it is disconnected as a result of a channel |
124 // error. This flag is used to indicate the same. | 124 // error. This flag is used to indicate the same. |
125 bool channel_valid_; | 125 bool channel_valid_; |
126 | 126 |
127 // Track whether we're within a synchronous dispatch; works like a refcount, | 127 // Track whether we're within a synchronous dispatch; works like a refcount, |
128 // 0 when we're not. | 128 // 0 when we're not. |
129 int in_sync_dispatch_; | 129 int in_sync_dispatch_; |
130 | 130 |
131 // If true, sync messages will only be marked as unblocking if the channel is | 131 // If true, sync messages will only be marked as unblocking if the channel is |
132 // in the middle of dispatching a synchronous message. | 132 // in the middle of dispatching a synchronous message. |
133 bool send_unblocking_only_during_sync_dispatch_; | 133 bool send_unblocking_only_during_sync_dispatch_; |
134 | 134 |
135 DISALLOW_COPY_AND_ASSIGN(PluginChannelBase); | 135 DISALLOW_COPY_AND_ASSIGN(PluginChannelBase); |
136 }; | 136 }; |
137 | 137 |
138 #endif // CHROME_PLUGIN_PLUGIN_CHANNEL_BASE_H_ | 138 #endif // CHROME_PLUGIN_PLUGIN_CHANNEL_BASE_H_ |
OLD | NEW |