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

Side by Side Diff: chrome/renderer/plugins/chrome_plugin_placeholder.cc

Issue 2211753002: Plugin Power Saver Tiny: Fix Plugin.PowerSaver.PeripheralHeuristic UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/renderer/plugins/chrome_plugin_placeholder.h" 5 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 context_menu_request_id_ = render_frame()->ShowContextMenu(this, params); 355 context_menu_request_id_ = render_frame()->ShowContextMenu(this, params);
356 g_last_active_menu = this; 356 g_last_active_menu = this;
357 } 357 }
358 358
359 blink::WebPlugin* ChromePluginPlaceholder::CreatePlugin() { 359 blink::WebPlugin* ChromePluginPlaceholder::CreatePlugin() {
360 std::unique_ptr<content::PluginInstanceThrottler> throttler; 360 std::unique_ptr<content::PluginInstanceThrottler> throttler;
361 // If the plugin has already been marked essential in its placeholder form, 361 // If the plugin has already been marked essential in its placeholder form,
362 // we shouldn't create a new throttler and start the process all over again. 362 // we shouldn't create a new throttler and start the process all over again.
363 if (power_saver_enabled()) { 363 if (power_saver_enabled()) {
364 throttler = content::PluginInstanceThrottler::Create(); 364 throttler = content::PluginInstanceThrottler::Create(
365 !heuristic_run_before_ /* record_decision */);
365 // PluginPreroller manages its own lifetime. 366 // PluginPreroller manages its own lifetime.
366 new PluginPreroller(render_frame(), GetFrame(), GetPluginParams(), 367 new PluginPreroller(render_frame(), GetFrame(), GetPluginParams(),
367 GetPluginInfo(), GetIdentifier(), title_, 368 GetPluginInfo(), GetIdentifier(), title_,
368 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_), 369 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_),
369 throttler.get()); 370 throttler.get());
370 } 371 }
371 return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(), 372 return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(),
372 GetPluginParams(), std::move(throttler)); 373 GetPluginParams(), std::move(throttler));
373 } 374 }
374 375
(...skipping 22 matching lines...) Expand all
397 398
398 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 399 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
399 switches::kEnablePluginPlaceholderTesting)) { 400 switches::kEnablePluginPlaceholderTesting)) {
400 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( 401 builder.SetMethod<void (ChromePluginPlaceholder::*)()>(
401 "didFinishIconRepositionForTesting", 402 "didFinishIconRepositionForTesting",
402 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); 403 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback);
403 } 404 }
404 405
405 return builder; 406 return builder;
406 } 407 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698