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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1522173002: Reland: Plugin Power Saver: Improve Poster behavior for essential plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix an NPE crash/race on plugin destruction Created 5 years 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 "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2121 } 2121 }
2122 2122
2123 #if defined(ENABLE_PLUGINS) 2123 #if defined(ENABLE_PLUGINS)
2124 void RenderFrameImpl::RegisterPeripheralPlugin( 2124 void RenderFrameImpl::RegisterPeripheralPlugin(
2125 const url::Origin& content_origin, 2125 const url::Origin& content_origin,
2126 const base::Closure& unthrottle_callback) { 2126 const base::Closure& unthrottle_callback) {
2127 return plugin_power_saver_helper_->RegisterPeripheralPlugin( 2127 return plugin_power_saver_helper_->RegisterPeripheralPlugin(
2128 content_origin, unthrottle_callback); 2128 content_origin, unthrottle_callback);
2129 } 2129 }
2130 2130
2131 bool RenderFrameImpl::ShouldThrottleContent( 2131 RenderFrame::PeripheralContentStatus
2132 RenderFrameImpl::GetPeripheralContentStatus(
2132 const url::Origin& main_frame_origin, 2133 const url::Origin& main_frame_origin,
2133 const url::Origin& content_origin, 2134 const url::Origin& content_origin,
2134 int width, 2135 const gfx::Size& unobscured_size) const {
2135 int height, 2136 return plugin_power_saver_helper_->GetPeripheralContentStatus(
2136 bool* cross_origin_main_content) const { 2137 main_frame_origin, content_origin, unobscured_size);
2137 return plugin_power_saver_helper_->ShouldThrottleContent(
2138 main_frame_origin, content_origin, width, height,
2139 cross_origin_main_content);
2140 } 2138 }
2141 2139
2142 void RenderFrameImpl::WhitelistContentOrigin( 2140 void RenderFrameImpl::WhitelistContentOrigin(
2143 const url::Origin& content_origin) { 2141 const url::Origin& content_origin) {
2144 return plugin_power_saver_helper_->WhitelistContentOrigin(content_origin); 2142 return plugin_power_saver_helper_->WhitelistContentOrigin(content_origin);
2145 } 2143 }
2146 #endif // defined(ENABLE_PLUGINS) 2144 #endif // defined(ENABLE_PLUGINS)
2147 2145
2148 bool RenderFrameImpl::IsFTPDirectoryListing() { 2146 bool RenderFrameImpl::IsFTPDirectoryListing() {
2149 WebURLResponseExtraDataImpl* extra_data = 2147 WebURLResponseExtraDataImpl* extra_data =
(...skipping 3395 matching lines...) Expand 10 before | Expand all | Expand 10 after
5545 media::ConvertToSwitchOutputDeviceCB(web_callbacks); 5543 media::ConvertToSwitchOutputDeviceCB(web_callbacks);
5546 scoped_refptr<media::AudioOutputDevice> device = 5544 scoped_refptr<media::AudioOutputDevice> device =
5547 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), 5545 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(),
5548 security_origin); 5546 security_origin);
5549 media::OutputDeviceStatus status = device->GetDeviceStatus(); 5547 media::OutputDeviceStatus status = device->GetDeviceStatus();
5550 device->Stop(); 5548 device->Stop();
5551 callback.Run(status); 5549 callback.Run(status);
5552 } 5550 }
5553 5551
5554 } // namespace content 5552 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698