Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: content/renderer/pepper/pepper_webplugin_impl.cc

Issue 2155583004: Plugins: Remove obsolete check in PepperWebPluginImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove extra check Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/pepper/pepper_webplugin_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 PepperWebPluginImpl::PepperWebPluginImpl( 61 PepperWebPluginImpl::PepperWebPluginImpl(
62 PluginModule* plugin_module, 62 PluginModule* plugin_module,
63 const WebPluginParams& params, 63 const WebPluginParams& params,
64 RenderFrameImpl* render_frame, 64 RenderFrameImpl* render_frame,
65 std::unique_ptr<PluginInstanceThrottlerImpl> throttler) 65 std::unique_ptr<PluginInstanceThrottlerImpl> throttler)
66 : init_data_(new InitData()), 66 : init_data_(new InitData()),
67 full_frame_(params.loadManually), 67 full_frame_(params.loadManually),
68 throttler_(std::move(throttler)), 68 throttler_(std::move(throttler)),
69 instance_object_(PP_MakeUndefined()), 69 instance_object_(PP_MakeUndefined()),
70 container_(nullptr), 70 container_(nullptr) {
71 destroyed_(false) {
72 DCHECK(plugin_module); 71 DCHECK(plugin_module);
73 init_data_->module = plugin_module; 72 init_data_->module = plugin_module;
74 init_data_->render_frame = render_frame; 73 init_data_->render_frame = render_frame;
75 for (size_t i = 0; i < params.attributeNames.size(); ++i) { 74 for (size_t i = 0; i < params.attributeNames.size(); ++i) {
76 init_data_->arg_names.push_back(params.attributeNames[i].utf8()); 75 init_data_->arg_names.push_back(params.attributeNames[i].utf8());
77 init_data_->arg_values.push_back(params.attributeValues[i].utf8()); 76 init_data_->arg_values.push_back(params.attributeValues[i].utf8());
78 } 77 }
79 init_data_->url = params.url; 78 init_data_->url = params.url;
80 79
81 // Set subresource URL for crash reporting. 80 // Set subresource URL for crash reporting.
(...skipping 22 matching lines...) Expand all
104 return false; 103 return false;
105 104
106 if (!instance_->Initialize(init_data_->arg_names, init_data_->arg_values, 105 if (!instance_->Initialize(init_data_->arg_names, init_data_->arg_values,
107 full_frame_, std::move(throttler_))) { 106 full_frame_, std::move(throttler_))) {
108 // If |container_| is nullptr, this object has already been synchronously 107 // If |container_| is nullptr, this object has already been synchronously
109 // destroy()-ed during |instance_|'s Initialize call. In that case, we early 108 // destroy()-ed during |instance_|'s Initialize call. In that case, we early
110 // exit. We neither create a replacement plugin nor destroy() ourselves. 109 // exit. We neither create a replacement plugin nor destroy() ourselves.
111 if (!container_) 110 if (!container_)
112 return false; 111 return false;
113 112
114 DCHECK(!destroyed_);
115
116 DCHECK(instance_); 113 DCHECK(instance_);
117 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); 114 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_);
118 instance_object_ = PP_MakeUndefined(); 115 instance_object_ = PP_MakeUndefined();
119 instance_->Delete(); 116 instance_->Delete();
120 instance_ = nullptr; 117 instance_ = nullptr;
121 118
122 blink::WebPlugin* replacement_plugin = 119 blink::WebPlugin* replacement_plugin =
123 GetContentClient()->renderer()->CreatePluginReplacement( 120 GetContentClient()->renderer()->CreatePluginReplacement(
124 init_data_->render_frame, init_data_->module->path()); 121 init_data_->render_frame, init_data_->module->path());
125 if (!replacement_plugin) 122 if (!replacement_plugin)
(...skipping 11 matching lines...) Expand all
137 destroy(); 134 destroy();
138 135
139 return true; 136 return true;
140 } 137 }
141 138
142 init_data_.reset(); 139 init_data_.reset();
143 return true; 140 return true;
144 } 141 }
145 142
146 void PepperWebPluginImpl::destroy() { 143 void PepperWebPluginImpl::destroy() {
147 // TODO(tommycli): Remove once we fix https://crbug.com/588624.
148 CHECK(!destroyed_);
149 destroyed_ = true;
150
151 container_ = nullptr; 144 container_ = nullptr;
152 145
153 if (instance_) { 146 if (instance_) {
154 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); 147 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_);
155 instance_object_ = PP_MakeUndefined(); 148 instance_object_ = PP_MakeUndefined();
156 instance_->Delete(); 149 instance_->Delete();
157 instance_ = nullptr; 150 instance_ = nullptr;
158 } 151 }
159 152
160 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); 153 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 293
301 bool PepperWebPluginImpl::canRotateView() { return instance_->CanRotateView(); } 294 bool PepperWebPluginImpl::canRotateView() { return instance_->CanRotateView(); }
302 295
303 void PepperWebPluginImpl::rotateView(RotationType type) { 296 void PepperWebPluginImpl::rotateView(RotationType type) {
304 instance_->RotateView(type); 297 instance_->RotateView(type);
305 } 298 }
306 299
307 bool PepperWebPluginImpl::isPlaceholder() { return false; } 300 bool PepperWebPluginImpl::isPlaceholder() { return false; }
308 301
309 } // namespace content 302 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_webplugin_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698