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

Side by Side Diff: content/renderer/pepper/message_channel.cc

Issue 596343003: PPAPI: Fix raymes's review comments I missed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | no next file » | 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 "content/renderer/pepper/message_channel.h" 5 #include "content/renderer/pepper/message_channel.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void MessageChannel::Start() { 159 void MessageChannel::Start() {
160 DCHECK_EQ(WAITING_TO_START, js_message_queue_state_); 160 DCHECK_EQ(WAITING_TO_START, js_message_queue_state_);
161 DCHECK_EQ(WAITING_TO_START, plugin_message_queue_state_); 161 DCHECK_EQ(WAITING_TO_START, plugin_message_queue_state_);
162 162
163 ppapi::proxy::HostDispatcher* dispatcher = 163 ppapi::proxy::HostDispatcher* dispatcher =
164 ppapi::proxy::HostDispatcher::GetForInstance(instance_->pp_instance()); 164 ppapi::proxy::HostDispatcher::GetForInstance(instance_->pp_instance());
165 // The dispatcher is NULL for in-process. 165 // The dispatcher is NULL for in-process.
166 if (dispatcher) 166 if (dispatcher)
167 dispatcher->AddSyncMessageStatusObserver(this); 167 dispatcher->AddSyncMessageStatusObserver(this);
168 168
169 // We can't drain the JS message queue directly 169 // We can't drain the JS message queue directly since we haven't finished
170 // since we haven't finished initializing the PepperWebPluginImpl yet, so 170 // initializing the PepperWebPluginImpl yet, so the plugin isn't available in
171 // the plugin isn't available in the DOM. 171 // the DOM.
172 DrainJSMessageQueueSoon(); 172 DrainJSMessageQueueSoon();
173 173
174 plugin_message_queue_state_ = SEND_DIRECTLY; 174 plugin_message_queue_state_ = SEND_DIRECTLY;
175 DrainCompletedPluginMessages(); 175 DrainCompletedPluginMessages();
176 } 176 }
177 177
178 void MessageChannel::SetPassthroughObject(v8::Handle<v8::Object> passthrough) { 178 void MessageChannel::SetPassthroughObject(v8::Handle<v8::Object> passthrough) {
179 passthrough_object_.Reset(instance_->GetIsolate(), passthrough); 179 passthrough_object_.Reset(instance_->GetIsolate(), passthrough);
180 } 180 }
181 181
(...skipping 20 matching lines...) Expand all
202 return Wrappable<MessageChannel>::GetObjectTemplateBuilder(isolate) 202 return Wrappable<MessageChannel>::GetObjectTemplateBuilder(isolate)
203 .AddNamedPropertyInterceptor(); 203 .AddNamedPropertyInterceptor();
204 } 204 }
205 205
206 void MessageChannel::BeginBlockOnSyncMessage() { 206 void MessageChannel::BeginBlockOnSyncMessage() {
207 js_message_queue_state_ = QUEUE_MESSAGES; 207 js_message_queue_state_ = QUEUE_MESSAGES;
208 ++blocking_message_depth_; 208 ++blocking_message_depth_;
209 } 209 }
210 210
211 void MessageChannel::EndBlockOnSyncMessage() { 211 void MessageChannel::EndBlockOnSyncMessage() {
212 DCHECK_GT(blocking_message_depth_, 0);
212 --blocking_message_depth_; 213 --blocking_message_depth_;
213 if (!blocking_message_depth_) 214 if (!blocking_message_depth_)
214 DrainJSMessageQueueSoon(); 215 DrainJSMessageQueueSoon();
215 } 216 }
216 217
217 v8::Local<v8::Value> MessageChannel::GetNamedProperty( 218 v8::Local<v8::Value> MessageChannel::GetNamedProperty(
218 v8::Isolate* isolate, 219 v8::Isolate* isolate,
219 const std::string& identifier) { 220 const std::string& identifier) {
220 if (!instance_) 221 if (!instance_)
221 return v8::Local<v8::Value>(); 222 return v8::Local<v8::Value>();
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 } 464 }
464 465
465 void MessageChannel::DrainJSMessageQueueSoon() { 466 void MessageChannel::DrainJSMessageQueueSoon() {
466 base::MessageLoop::current()->PostTask( 467 base::MessageLoop::current()->PostTask(
467 FROM_HERE, 468 FROM_HERE,
468 base::Bind(&MessageChannel::DrainJSMessageQueue, 469 base::Bind(&MessageChannel::DrainJSMessageQueue,
469 weak_ptr_factory_.GetWeakPtr())); 470 weak_ptr_factory_.GetWeakPtr()));
470 } 471 }
471 472
472 } // namespace content 473 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698