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

Side by Side Diff: components/plugins/renderer/loadable_plugin_placeholder.cc

Issue 2504573003: Plugin Power Saver: Fix race between GIN bindings and destruction (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/plugins/renderer/loadable_plugin_placeholder.h" 5 #include "components/plugins/renderer/loadable_plugin_placeholder.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 // In case our initial geometry was reported before the placeholder finished 324 // In case our initial geometry was reported before the placeholder finished
325 // loading, request another one. Needed for correct large poster unthrottling. 325 // loading, request another one. Needed for correct large poster unthrottling.
326 if (plugin()) { 326 if (plugin()) {
327 CHECK(plugin()->container()); 327 CHECK(plugin()->container());
328 plugin()->container()->reportGeometry(); 328 plugin()->container()->reportGeometry();
329 } 329 }
330 } 330 }
331 331
332 void LoadablePluginPlaceholder::DidFinishIconRepositionForTestingCallback() { 332 void LoadablePluginPlaceholder::DidFinishIconRepositionForTestingCallback() {
333 if (!plugin())
334 return;
335
333 // Set an attribute and post an event, so browser tests can wait for the 336 // Set an attribute and post an event, so browser tests can wait for the
334 // placeholder to be ready to receive simulated user input. 337 // placeholder to be ready to receive simulated user input.
335 blink::WebElement element = plugin()->container()->element(); 338 blink::WebElement element = plugin()->container()->element();
336 element.setAttribute("placeholderReady", "true"); 339 element.setAttribute("placeholderReady", "true");
337 340
338 std::unique_ptr<content::V8ValueConverter> converter( 341 std::unique_ptr<content::V8ValueConverter> converter(
339 content::V8ValueConverter::create()); 342 content::V8ValueConverter::create());
340 base::StringValue value("placeholderReady"); 343 base::StringValue value("placeholderReady");
341 blink::WebSerializedScriptValue message_data = 344 blink::WebSerializedScriptValue message_data =
342 blink::WebSerializedScriptValue::serialize(converter->ToV8Value( 345 blink::WebSerializedScriptValue::serialize(converter->ToV8Value(
(...skipping 20 matching lines...) Expand all
363 return identifier_; 366 return identifier_;
364 } 367 }
365 368
366 bool LoadablePluginPlaceholder::LoadingBlocked() const { 369 bool LoadablePluginPlaceholder::LoadingBlocked() const {
367 DCHECK(allow_loading_); 370 DCHECK(allow_loading_);
368 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || 371 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ ||
369 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; 372 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_;
370 } 373 }
371 374
372 } // namespace plugins 375 } // namespace plugins
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698