| 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. |
| 56 filter->AddRef(); |
| 53 channel()->AddFilter(filter); | 57 channel()->AddFilter(filter); |
| 54 } | 58 } |
| 55 | 59 |
| 56 bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { | 60 bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { |
| 57 if (msg.routing_id() <= 0 || msg.routing_id() >= API_ID_COUNT) { | 61 if (msg.routing_id() <= 0 || msg.routing_id() >= API_ID_COUNT) { |
| 58 OnInvalidMessageReceived(); | 62 OnInvalidMessageReceived(); |
| 59 return true; | 63 return true; |
| 60 } | 64 } |
| 61 | 65 |
| 62 InterfaceProxy* proxy = GetInterfaceProxy( | 66 InterfaceProxy* proxy = GetInterfaceProxy( |
| 63 static_cast<ApiID>(msg.routing_id())); | 67 static_cast<ApiID>(msg.routing_id())); |
| 64 if (!proxy) { | 68 if (!proxy) { |
| 65 NOTREACHED(); | 69 NOTREACHED(); |
| 66 return true; | 70 return true; |
| 67 } | 71 } |
| 68 return proxy->OnMessageReceived(msg); | 72 return proxy->OnMessageReceived(msg); |
| 69 } | 73 } |
| 70 | 74 |
| 71 void Dispatcher::SetSerializationRules( | 75 void Dispatcher::SetSerializationRules( |
| 72 VarSerializationRules* var_serialization_rules) { | 76 VarSerializationRules* var_serialization_rules) { |
| 73 serialization_rules_ = var_serialization_rules; | 77 serialization_rules_ = var_serialization_rules; |
| 74 } | 78 } |
| 75 | 79 |
| 76 void Dispatcher::OnInvalidMessageReceived() { | 80 void Dispatcher::OnInvalidMessageReceived() { |
| 77 } | 81 } |
| 78 | 82 |
| 79 } // namespace proxy | 83 } // namespace proxy |
| 80 } // namespace ppapi | 84 } // namespace ppapi |
| OLD | NEW |