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_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 void PepperPluginInstanceImpl::Delete() { | 663 void PepperPluginInstanceImpl::Delete() { |
664 is_deleted_ = true; | 664 is_deleted_ = true; |
665 | 665 |
666 if (render_frame_ && render_frame_->render_view() && | 666 if (render_frame_ && render_frame_->render_view() && |
667 render_frame_->render_view()->plugin_find_handler() == this) { | 667 render_frame_->render_view()->plugin_find_handler() == this) { |
668 render_frame_->render_view()->set_plugin_find_handler(NULL); | 668 render_frame_->render_view()->set_plugin_find_handler(NULL); |
669 } | 669 } |
670 | 670 |
671 // Keep a reference on the stack. See NOTE above. | 671 // Keep a reference on the stack. See NOTE above. |
672 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 672 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| 673 |
| 674 // It is important to destroy the throttler before anything else. |
| 675 // The plugin instance may flush its graphics pipeline during its postmortem |
| 676 // spasm, causing the throttler to engage and obtain new dangling reference |
| 677 // to the plugin container being destroyed. |
| 678 throttler_.reset(); |
| 679 |
673 // Force the MessageChannel to release its "passthrough object" which should | 680 // Force the MessageChannel to release its "passthrough object" which should |
674 // release our last reference to the "InstanceObject" and will probably | 681 // release our last reference to the "InstanceObject" and will probably |
675 // destroy it. We want to do this prior to calling DidDestroy in case the | 682 // destroy it. We want to do this prior to calling DidDestroy in case the |
676 // destructor of the instance object tries to use the instance. | 683 // destructor of the instance object tries to use the instance. |
677 if (message_channel_) | 684 if (message_channel_) |
678 message_channel_->SetPassthroughObject(v8::Local<v8::Object>()); | 685 message_channel_->SetPassthroughObject(v8::Local<v8::Object>()); |
679 // If this is a NaCl plugin instance, shut down the NaCl plugin by calling | 686 // If this is a NaCl plugin instance, shut down the NaCl plugin by calling |
680 // its DidDestroy. Don't call DidDestroy on the untrusted plugin instance, | 687 // its DidDestroy. Don't call DidDestroy on the untrusted plugin instance, |
681 // since there is little that it can do at this point. | 688 // since there is little that it can do at this point. |
682 if (original_instance_interface_) { | 689 if (original_instance_interface_) { |
(...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3342 | 3349 |
3343 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { | 3350 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { |
3344 if (initialized_ && !javascript_used_ && is_flash_plugin_) { | 3351 if (initialized_ && !javascript_used_ && is_flash_plugin_) { |
3345 javascript_used_ = true; | 3352 javascript_used_ = true; |
3346 RenderThread::Get()->RecordAction( | 3353 RenderThread::Get()->RecordAction( |
3347 base::UserMetricsAction("Flash.JavaScriptUsed")); | 3354 base::UserMetricsAction("Flash.JavaScriptUsed")); |
3348 } | 3355 } |
3349 } | 3356 } |
3350 | 3357 |
3351 } // namespace content | 3358 } // namespace content |
OLD | NEW |