| 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 "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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 MessageChannel::MessageChannelNPObject::MessageChannelNPObject() { | 295 MessageChannel::MessageChannelNPObject::MessageChannelNPObject() { |
| 296 } | 296 } |
| 297 | 297 |
| 298 MessageChannel::MessageChannelNPObject::~MessageChannelNPObject() {} | 298 MessageChannel::MessageChannelNPObject::~MessageChannelNPObject() {} |
| 299 | 299 |
| 300 MessageChannel::MessageChannel(PepperPluginInstanceImpl* instance) | 300 MessageChannel::MessageChannel(PepperPluginInstanceImpl* instance) |
| 301 : instance_(instance), | 301 : instance_(instance), |
| 302 passthrough_object_(NULL), | 302 passthrough_object_(NULL), |
| 303 np_object_(NULL), | 303 np_object_(NULL), |
| 304 weak_ptr_factory_(this), | 304 early_message_queue_state_(QUEUE_MESSAGES), |
| 305 early_message_queue_state_(QUEUE_MESSAGES) { | 305 weak_ptr_factory_(this) { |
| 306 // Now create an NPObject for receiving calls to postMessage. This sets the | 306 // Now create an NPObject for receiving calls to postMessage. This sets the |
| 307 // reference count to 1. We release it in the destructor. | 307 // reference count to 1. We release it in the destructor. |
| 308 NPObject* obj = WebBindings::createObject(instance_->instanceNPP(), | 308 NPObject* obj = WebBindings::createObject(instance_->instanceNPP(), |
| 309 &message_channel_class); | 309 &message_channel_class); |
| 310 DCHECK(obj); | 310 DCHECK(obj); |
| 311 np_object_ = static_cast<MessageChannel::MessageChannelNPObject*>(obj); | 311 np_object_ = static_cast<MessageChannel::MessageChannelNPObject*>(obj); |
| 312 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); | 312 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 void MessageChannel::NPVariantToPPVar(const NPVariant* variant) { | 315 void MessageChannel::NPVariantToPPVar(const NPVariant* variant) { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 // incoming passthrough object first, so that we behave correctly if anyone | 552 // incoming passthrough object first, so that we behave correctly if anyone |
| 553 // invokes: | 553 // invokes: |
| 554 // SetPassthroughObject(passthrough_object()); | 554 // SetPassthroughObject(passthrough_object()); |
| 555 if (passthrough_object_) | 555 if (passthrough_object_) |
| 556 WebBindings::releaseObject(passthrough_object_); | 556 WebBindings::releaseObject(passthrough_object_); |
| 557 | 557 |
| 558 passthrough_object_ = passthrough; | 558 passthrough_object_ = passthrough; |
| 559 } | 559 } |
| 560 | 560 |
| 561 } // namespace content | 561 } // namespace content |
| OLD | NEW |