Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: ppapi/proxy/dispatcher.cc

Issue 589213003: PPAPI: Never re-enter JavaScript for PostMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make MessageChannel observer clean up more reliably, guarantee HungPluginFilter stays alive long en… Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/proxy/dispatcher.h ('k') | ppapi/proxy/host_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 NOTREACHED(); 40 NOTREACHED();
41 return NULL; 41 return NULL;
42 } 42 }
43 proxy = factory(this); 43 proxy = factory(this);
44 DCHECK(proxy); 44 DCHECK(proxy);
45 proxies_[id].reset(proxy); 45 proxies_[id].reset(proxy);
46 } 46 }
47 return proxy; 47 return proxy;
48 } 48 }
49 49
50 void Dispatcher::AddIOThreadMessageFilter(IPC::MessageFilter* filter) { 50 void Dispatcher::AddIOThreadMessageFilter(
51 scoped_refptr<IPC::MessageFilter> filter) {
51 // Our filter is refcounted. The channel will call the destruct method on the 52 // Our filter is refcounted. The channel will call the destruct method on the
52 // filter when the channel is done with it, so the corresponding Release() 53 // filter when the channel is done with it, so the corresponding Release()
53 // happens there. 54 // happens there.
54 channel()->AddFilter(filter); 55 channel()->AddFilter(filter.get());
55 } 56 }
56 57
57 bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { 58 bool Dispatcher::OnMessageReceived(const IPC::Message& msg) {
58 if (msg.routing_id() <= 0 || msg.routing_id() >= API_ID_COUNT) { 59 if (msg.routing_id() <= 0 || msg.routing_id() >= API_ID_COUNT) {
59 OnInvalidMessageReceived(); 60 OnInvalidMessageReceived();
60 return true; 61 return true;
61 } 62 }
62 63
63 InterfaceProxy* proxy = GetInterfaceProxy( 64 InterfaceProxy* proxy = GetInterfaceProxy(
64 static_cast<ApiID>(msg.routing_id())); 65 static_cast<ApiID>(msg.routing_id()));
65 if (!proxy) { 66 if (!proxy) {
66 NOTREACHED(); 67 NOTREACHED();
67 return true; 68 return true;
68 } 69 }
69 return proxy->OnMessageReceived(msg); 70 return proxy->OnMessageReceived(msg);
70 } 71 }
71 72
72 void Dispatcher::SetSerializationRules( 73 void Dispatcher::SetSerializationRules(
73 VarSerializationRules* var_serialization_rules) { 74 VarSerializationRules* var_serialization_rules) {
74 serialization_rules_ = var_serialization_rules; 75 serialization_rules_ = var_serialization_rules;
75 } 76 }
76 77
77 void Dispatcher::OnInvalidMessageReceived() { 78 void Dispatcher::OnInvalidMessageReceived() {
78 } 79 }
79 80
80 } // namespace proxy 81 } // namespace proxy
81 } // namespace ppapi 82 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/dispatcher.h ('k') | ppapi/proxy/host_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698