| 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 #include "ppapi/proxy/dispatcher.h" | 5 #include "ppapi/proxy/dispatcher.h" |
| 6 | 6 |
| 7 #include <string.h> // For memset. | 7 #include <string.h> // For memset. |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 return proxy; | 44 return proxy; |
| 45 } | 45 } |
| 46 | 46 |
| 47 base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() { | 47 base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() { |
| 48 return delegate()->GetIPCMessageLoop(); | 48 return delegate()->GetIPCMessageLoop(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void Dispatcher::AddIOThreadMessageFilter( | 51 void Dispatcher::AddIOThreadMessageFilter( |
| 52 IPC::ChannelProxy::MessageFilter* filter) { | 52 IPC::ChannelProxy::MessageFilter* filter) { |
| 53 // Our filter is refcounted. The channel will call the destruct method on the |
| 54 // filter when the channel is done with it, so the corresponding Release() |
| 55 // happens there. |
| 53 channel()->AddFilter(filter); | 56 channel()->AddFilter(filter); |
| 54 } | 57 } |
| 55 | 58 |
| 56 bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { | 59 bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { |
| 57 if (msg.routing_id() <= 0 || msg.routing_id() >= API_ID_COUNT) { | 60 if (msg.routing_id() <= 0 || msg.routing_id() >= API_ID_COUNT) { |
| 58 OnInvalidMessageReceived(); | 61 OnInvalidMessageReceived(); |
| 59 return true; | 62 return true; |
| 60 } | 63 } |
| 61 | 64 |
| 62 InterfaceProxy* proxy = GetInterfaceProxy( | 65 InterfaceProxy* proxy = GetInterfaceProxy( |
| 63 static_cast<ApiID>(msg.routing_id())); | 66 static_cast<ApiID>(msg.routing_id())); |
| 64 if (!proxy) { | 67 if (!proxy) { |
| 65 NOTREACHED(); | 68 NOTREACHED(); |
| 66 return true; | 69 return true; |
| 67 } | 70 } |
| 68 return proxy->OnMessageReceived(msg); | 71 return proxy->OnMessageReceived(msg); |
| 69 } | 72 } |
| 70 | 73 |
| 71 void Dispatcher::SetSerializationRules( | 74 void Dispatcher::SetSerializationRules( |
| 72 VarSerializationRules* var_serialization_rules) { | 75 VarSerializationRules* var_serialization_rules) { |
| 73 serialization_rules_ = var_serialization_rules; | 76 serialization_rules_ = var_serialization_rules; |
| 74 } | 77 } |
| 75 | 78 |
| 76 void Dispatcher::OnInvalidMessageReceived() { | 79 void Dispatcher::OnInvalidMessageReceived() { |
| 77 } | 80 } |
| 78 | 81 |
| 79 } // namespace proxy | 82 } // namespace proxy |
| 80 } // namespace ppapi | 83 } // namespace ppapi |
| OLD | NEW |