| 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 "app/gfx/native_widget_types.h" | 10 #include "app/gfx/native_widget_types.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 // Implemented by derived classes to handle control messages | 79 // Implemented by derived classes to handle control messages |
| 80 virtual void OnControlMessageReceived(const IPC::Message& msg); | 80 virtual void OnControlMessageReceived(const IPC::Message& msg); |
| 81 | 81 |
| 82 // IPC::Channel::Listener implementation: | 82 // IPC::Channel::Listener implementation: |
| 83 virtual void OnMessageReceived(const IPC::Message& msg); | 83 virtual void OnMessageReceived(const IPC::Message& msg); |
| 84 virtual void OnChannelConnected(int32 peer_pid); | 84 virtual void OnChannelConnected(int32 peer_pid); |
| 85 virtual void OnChannelError(); | 85 virtual void OnChannelError(); |
| 86 | 86 |
| 87 // If this is set, sync messages that are sent will only unblock the receiver | 87 // If this is set, sync messages that are sent will only unblock the receiver |
| 88 // if this channel is in the middle of a dispatch. | 88 // if this channel is in the middle of a sync dispatch. |
| 89 void SendUnblockingOnlyDuringDispatch(); | 89 void SendUnblockingOnlyDuringSyncDispatch(); |
| 90 | 90 |
| 91 virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now); | 91 virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now); |
| 92 | 92 |
| 93 scoped_ptr<IPC::SyncChannel> channel_; | 93 scoped_ptr<IPC::SyncChannel> channel_; |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 IPC::Channel::Mode mode_; | 96 IPC::Channel::Mode mode_; |
| 97 std::string channel_name_; | 97 std::string channel_name_; |
| 98 int plugin_count_; | 98 int plugin_count_; |
| 99 int peer_pid_; | 99 int peer_pid_; |
| 100 | 100 |
| 101 // true when in the middle of a RemoveRoute call | 101 // true when in the middle of a RemoveRoute call |
| 102 bool in_remove_route_; | 102 bool in_remove_route_; |
| 103 | 103 |
| 104 // Keep track of all the registered NPObjects proxies/stubs so that when the | 104 // Keep track of all the registered NPObjects proxies/stubs so that when the |
| 105 // channel is closed we can inform them. | 105 // channel is closed we can inform them. |
| 106 typedef base::hash_map<int, IPC::Channel::Listener*> ListenerMap; | 106 typedef base::hash_map<int, IPC::Channel::Listener*> ListenerMap; |
| 107 ListenerMap npobject_listeners_; | 107 ListenerMap npobject_listeners_; |
| 108 | 108 |
| 109 // Used to implement message routing functionality to WebPlugin[Delegate] | 109 // Used to implement message routing functionality to WebPlugin[Delegate] |
| 110 // objects | 110 // objects |
| 111 MessageRouter router_; | 111 MessageRouter router_; |
| 112 | 112 |
| 113 // A channel is invalid if it is disconnected as a result of a channel | 113 // A channel is invalid if it is disconnected as a result of a channel |
| 114 // error. This flag is used to indicate the same. | 114 // error. This flag is used to indicate the same. |
| 115 bool channel_valid_; | 115 bool channel_valid_; |
| 116 | 116 |
| 117 // Track whether we're within a dispatch; works like a refcount, 0 when we're | 117 // Track whether we're within a synchronous dispatch; works like a refcount, |
| 118 // not. | 118 // 0 when we're not. |
| 119 int in_dispatch_; | 119 int in_sync_dispatch_; |
| 120 | 120 |
| 121 // If true, sync messages will only be marked as unblocking if the channel is | 121 // If true, sync messages will only be marked as unblocking if the channel is |
| 122 // in the middle of dispatching a message. | 122 // in the middle of dispatching a synchronous message. |
| 123 bool send_unblocking_only_during_dispatch_; | 123 bool send_unblocking_only_during_sync_dispatch_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(PluginChannelBase); | 125 DISALLOW_COPY_AND_ASSIGN(PluginChannelBase); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 #endif // CHROME_PLUGIN_PLUGIN_CHANNEL_BASE_H_ | 128 #endif // CHROME_PLUGIN_PLUGIN_CHANNEL_BASE_H_ |
| OLD | NEW |