Chromium Code Reviews| 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/pepper_webplugin_impl.h" | 5 #include "content/renderer/pepper/pepper_webplugin_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 | 117 |
| 118 init_data_.reset(); | 118 init_data_.reset(); |
| 119 container_ = container; | 119 container_ = container; |
| 120 return true; | 120 return true; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void PepperWebPluginImpl::destroy() { | 123 void PepperWebPluginImpl::destroy() { |
| 124 // Tell |container_| to clear references to this plugin's script objects. | 124 // Tell |container_| to clear references to this plugin's script objects. |
| 125 if (container_) | 125 if (container_) |
| 126 container_->clearScriptObjects(); | 126 container_->clearScriptObjects(); |
| 127 container_ = nullptr; | |
| 127 | 128 |
| 128 if (instance_.get()) { | 129 if (instance_.get()) { |
| 129 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); | 130 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); |
| 130 instance_object_ = PP_MakeUndefined(); | 131 instance_object_ = PP_MakeUndefined(); |
| 131 instance_->Delete(); | 132 instance_->Delete(); |
| 132 instance_ = NULL; | 133 instance_ = NULL; |
| 133 } | 134 } |
| 135 throttler_.reset(); | |
|
tommycli
2015/05/11 21:57:23
If the plugin has been initialized, the throttler_
trchen
2015/05/11 22:09:09
Done.
| |
| 134 | 136 |
| 135 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 137 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 136 } | 138 } |
| 137 | 139 |
| 138 v8::Local<v8::Object> PepperWebPluginImpl::v8ScriptableObject( | 140 v8::Local<v8::Object> PepperWebPluginImpl::v8ScriptableObject( |
| 139 v8::Isolate* isolate) { | 141 v8::Isolate* isolate) { |
| 140 // Call through the plugin to get its instance object. The plugin should pass | 142 // Call through the plugin to get its instance object. The plugin should pass |
| 141 // us a reference which we release in destroy(). | 143 // us a reference which we release in destroy(). |
| 142 if (instance_object_.type == PP_VARTYPE_UNDEFINED) | 144 if (instance_object_.type == PP_VARTYPE_UNDEFINED) |
| 143 instance_object_ = instance_->GetInstanceObject(isolate); | 145 instance_object_ = instance_->GetInstanceObject(isolate); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 | 290 |
| 289 bool PepperWebPluginImpl::canRotateView() { return instance_->CanRotateView(); } | 291 bool PepperWebPluginImpl::canRotateView() { return instance_->CanRotateView(); } |
| 290 | 292 |
| 291 void PepperWebPluginImpl::rotateView(RotationType type) { | 293 void PepperWebPluginImpl::rotateView(RotationType type) { |
| 292 instance_->RotateView(type); | 294 instance_->RotateView(type); |
| 293 } | 295 } |
| 294 | 296 |
| 295 bool PepperWebPluginImpl::isPlaceholder() { return false; } | 297 bool PepperWebPluginImpl::isPlaceholder() { return false; } |
| 296 | 298 |
| 297 } // namespace content | 299 } // namespace content |
| OLD | NEW |