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 "webkit/plugins/ppapi/message_channel.h" | 5 #include "webkit/plugins/ppapi/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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // MessageChannel -------------------------------------------------------------- | 324 // MessageChannel -------------------------------------------------------------- |
325 MessageChannel::MessageChannelNPObject::MessageChannelNPObject() { | 325 MessageChannel::MessageChannelNPObject::MessageChannelNPObject() { |
326 } | 326 } |
327 | 327 |
328 MessageChannel::MessageChannelNPObject::~MessageChannelNPObject() {} | 328 MessageChannel::MessageChannelNPObject::~MessageChannelNPObject() {} |
329 | 329 |
330 MessageChannel::MessageChannel(PluginInstance* instance) | 330 MessageChannel::MessageChannel(PluginInstance* instance) |
331 : instance_(instance), | 331 : instance_(instance), |
332 passthrough_object_(NULL), | 332 passthrough_object_(NULL), |
333 np_object_(NULL), | 333 np_object_(NULL), |
334 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), | 334 weak_ptr_factory_(this), |
335 early_message_queue_state_(QUEUE_MESSAGES) { | 335 early_message_queue_state_(QUEUE_MESSAGES) { |
336 // Now create an NPObject for receiving calls to postMessage. This sets the | 336 // Now create an NPObject for receiving calls to postMessage. This sets the |
337 // reference count to 1. We release it in the destructor. | 337 // reference count to 1. We release it in the destructor. |
338 NPObject* obj = WebBindings::createObject(NULL, &message_channel_class); | 338 NPObject* obj = WebBindings::createObject(NULL, &message_channel_class); |
339 DCHECK(obj); | 339 DCHECK(obj); |
340 np_object_ = static_cast<MessageChannel::MessageChannelNPObject*>(obj); | 340 np_object_ = static_cast<MessageChannel::MessageChannelNPObject*>(obj); |
341 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); | 341 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); |
342 } | 342 } |
343 | 343 |
344 void MessageChannel::PostMessageToJavaScript(PP_Var message_data) { | 344 void MessageChannel::PostMessageToJavaScript(PP_Var message_data) { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 // invokes: | 493 // invokes: |
494 // SetPassthroughObject(passthrough_object()); | 494 // SetPassthroughObject(passthrough_object()); |
495 if (passthrough_object_) | 495 if (passthrough_object_) |
496 WebBindings::releaseObject(passthrough_object_); | 496 WebBindings::releaseObject(passthrough_object_); |
497 | 497 |
498 passthrough_object_ = passthrough; | 498 passthrough_object_ = passthrough; |
499 } | 499 } |
500 | 500 |
501 } // namespace ppapi | 501 } // namespace ppapi |
502 } // namespace webkit | 502 } // namespace webkit |
OLD | NEW |