| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 GURL url; | 56 GURL url; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 PepperWebPluginImpl::PepperWebPluginImpl( | 59 PepperWebPluginImpl::PepperWebPluginImpl( |
| 60 PluginModule* plugin_module, | 60 PluginModule* plugin_module, |
| 61 const WebPluginParams& params, | 61 const WebPluginParams& params, |
| 62 RenderFrameImpl* render_frame, | 62 RenderFrameImpl* render_frame, |
| 63 scoped_ptr<PluginInstanceThrottlerImpl> throttler) | 63 scoped_ptr<PluginInstanceThrottlerImpl> throttler) |
| 64 : init_data_(new InitData()), | 64 : init_data_(new InitData()), |
| 65 full_frame_(params.loadManually), | 65 full_frame_(params.loadManually), |
| 66 instance_object_(PP_MakeUndefined()), |
| 66 throttler_(throttler.Pass()), | 67 throttler_(throttler.Pass()), |
| 67 instance_object_(PP_MakeUndefined()), | |
| 68 container_(NULL) { | 68 container_(NULL) { |
| 69 DCHECK(plugin_module); | 69 DCHECK(plugin_module); |
| 70 init_data_->module = plugin_module; | 70 init_data_->module = plugin_module; |
| 71 init_data_->render_frame = render_frame; | 71 init_data_->render_frame = render_frame; |
| 72 for (size_t i = 0; i < params.attributeNames.size(); ++i) { | 72 for (size_t i = 0; i < params.attributeNames.size(); ++i) { |
| 73 init_data_->arg_names.push_back(params.attributeNames[i].utf8()); | 73 init_data_->arg_names.push_back(params.attributeNames[i].utf8()); |
| 74 init_data_->arg_values.push_back(params.attributeValues[i].utf8()); | 74 init_data_->arg_values.push_back(params.attributeValues[i].utf8()); |
| 75 } | 75 } |
| 76 init_data_->url = params.url; | 76 init_data_->url = params.url; |
| 77 | 77 |
| (...skipping 39 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; |
| 128 throttler_.reset(); |
| 127 | 129 |
| 128 if (instance_.get()) { | 130 if (instance_.get()) { |
| 129 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); | 131 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); |
| 130 instance_object_ = PP_MakeUndefined(); | 132 instance_object_ = PP_MakeUndefined(); |
| 131 instance_->Delete(); | 133 instance_->Delete(); |
| 132 instance_ = NULL; | 134 instance_ = NULL; |
| 133 } | 135 } |
| 134 | 136 |
| 135 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 137 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 136 } | 138 } |
| (...skipping 151 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 |