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

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

Issue 6862002: Merge gpu_trace_event back into base/debug/trace_event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to 84062 Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/host_dispatcher.h" 5 #include "ppapi/proxy/host_dispatcher.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "gpu/common/gpu_trace_event.h"
11 #include "ppapi/c/private/ppb_proxy_private.h" 11 #include "ppapi/c/private/ppb_proxy_private.h"
12 #include "ppapi/c/dev/ppb_var_deprecated.h" 12 #include "ppapi/c/dev/ppb_var_deprecated.h"
13 #include "ppapi/proxy/host_var_serialization_rules.h" 13 #include "ppapi/proxy/host_var_serialization_rules.h"
14 #include "ppapi/proxy/ppapi_messages.h" 14 #include "ppapi/proxy/ppapi_messages.h"
15 15
16 namespace pp { 16 namespace pp {
17 namespace proxy { 17 namespace proxy {
18 18
19 namespace { 19 namespace {
20 20
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 instance); 122 instance);
123 if (found != g_instance_to_dispatcher->end()) 123 if (found != g_instance_to_dispatcher->end())
124 g_instance_to_dispatcher->erase(found); 124 g_instance_to_dispatcher->erase(found);
125 } 125 }
126 126
127 bool HostDispatcher::IsPlugin() const { 127 bool HostDispatcher::IsPlugin() const {
128 return false; 128 return false;
129 } 129 }
130 130
131 bool HostDispatcher::Send(IPC::Message* msg) { 131 bool HostDispatcher::Send(IPC::Message* msg) {
132 GPU_TRACE_EVENT2("ppapi proxy", "HostDispatcher::Send", 132 TRACE_EVENT2("ppapi proxy", "HostDispatcher::Send",
133 "Class", IPC_MESSAGE_ID_CLASS(msg->type()), 133 "Class", IPC_MESSAGE_ID_CLASS(msg->type()),
134 "Line", IPC_MESSAGE_ID_LINE(msg->type())); 134 "Line", IPC_MESSAGE_ID_LINE(msg->type()));
135 // Normal sync messages are set to unblock, which would normally cause the 135 // Normal sync messages are set to unblock, which would normally cause the
136 // plugin to be reentered to process them. We only want to do this when we 136 // plugin to be reentered to process them. We only want to do this when we
137 // know the plugin is in a state to accept reentrancy. Since the plugin side 137 // know the plugin is in a state to accept reentrancy. Since the plugin side
138 // never clears this flag on messages it sends, we can't get deadlock, but we 138 // never clears this flag on messages it sends, we can't get deadlock, but we
139 // may still get reentrancy in the host as a result. 139 // may still get reentrancy in the host as a result.
140 if (!allow_plugin_reentrancy_) 140 if (!allow_plugin_reentrancy_)
141 msg->set_unblock(false); 141 msg->set_unblock(false);
142 return Dispatcher::Send(msg); 142 return Dispatcher::Send(msg);
143 } 143 }
144 144
145 bool HostDispatcher::OnMessageReceived(const IPC::Message& msg) { 145 bool HostDispatcher::OnMessageReceived(const IPC::Message& msg) {
146 GPU_TRACE_EVENT2("ppapi proxy", "HostDispatcher::OnMessageReceived", 146 TRACE_EVENT2("ppapi proxy", "HostDispatcher::OnMessageReceived",
147 "Class", IPC_MESSAGE_ID_CLASS(msg.type()), 147 "Class", IPC_MESSAGE_ID_CLASS(msg.type()),
148 "Line", IPC_MESSAGE_ID_LINE(msg.type())); 148 "Line", IPC_MESSAGE_ID_LINE(msg.type()));
149 // We only want to allow reentrancy when the most recent message from the 149 // We only want to allow reentrancy when the most recent message from the
150 // plugin was a scripting message. We save the old state of the flag on the 150 // plugin was a scripting message. We save the old state of the flag on the
151 // stack in case we're (we are the host) being reentered ourselves. The flag 151 // stack in case we're (we are the host) being reentered ourselves. The flag
152 // is set to false here for all messages, and then the scripting API will 152 // is set to false here for all messages, and then the scripting API will
153 // explicitly set it to true during processing of those messages that can be 153 // explicitly set it to true during processing of those messages that can be
154 // reentered. 154 // reentered.
155 BoolRestorer restorer(&allow_plugin_reentrancy_); 155 BoolRestorer restorer(&allow_plugin_reentrancy_);
156 allow_plugin_reentrancy_ = false; 156 allow_plugin_reentrancy_ = false;
157 157
158 // Handle common control messages. 158 // Handle common control messages.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); 256 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module());
257 } 257 }
258 258
259 ScopedModuleReference::~ScopedModuleReference() { 259 ScopedModuleReference::~ScopedModuleReference() {
260 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); 260 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module());
261 } 261 }
262 262
263 } // namespace proxy 263 } // namespace proxy
264 } // namespace pp 264 } // namespace pp
265 265
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698