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

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

Issue 929483004: Plugin Power Saver: Throttled Plugins should block TCPSocket reads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/common/view_messages.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_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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_offset_string_conversions.h" 14 #include "base/strings/utf_offset_string_conversions.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "cc/base/latency_info_swap_promise.h" 18 #include "cc/base/latency_info_swap_promise.h"
19 #include "cc/blink/web_layer_impl.h" 19 #include "cc/blink/web_layer_impl.h"
20 #include "cc/layers/texture_layer.h" 20 #include "cc/layers/texture_layer.h"
21 #include "cc/trees/layer_tree_host.h" 21 #include "cc/trees/layer_tree_host.h"
22 #include "content/common/content_constants_internal.h" 22 #include "content/common/content_constants_internal.h"
23 #include "content/common/frame_messages.h" 23 #include "content/common/frame_messages.h"
24 #include "content/common/input/web_input_event_traits.h" 24 #include "content/common/input/web_input_event_traits.h"
25 #include "content/common/view_messages.h"
25 #include "content/public/common/content_constants.h" 26 #include "content/public/common/content_constants.h"
26 #include "content/public/common/page_zoom.h" 27 #include "content/public/common/page_zoom.h"
27 #include "content/public/renderer/content_renderer_client.h" 28 #include "content/public/renderer/content_renderer_client.h"
28 #include "content/renderer/gpu/render_widget_compositor.h" 29 #include "content/renderer/gpu/render_widget_compositor.h"
29 #include "content/renderer/pepper/content_decryptor_delegate.h" 30 #include "content/renderer/pepper/content_decryptor_delegate.h"
30 #include "content/renderer/pepper/event_conversion.h" 31 #include "content/renderer/pepper/event_conversion.h"
31 #include "content/renderer/pepper/fullscreen_container.h" 32 #include "content/renderer/pepper/fullscreen_container.h"
32 #include "content/renderer/pepper/gfx_conversion.h" 33 #include "content/renderer/pepper/gfx_conversion.h"
33 #include "content/renderer/pepper/host_dispatcher_wrapper.h" 34 #include "content/renderer/pepper/host_dispatcher_wrapper.h"
34 #include "content/renderer/pepper/host_globals.h" 35 #include "content/renderer/pepper/host_globals.h"
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 if (!bound_graphics_2d_platform_) 2042 if (!bound_graphics_2d_platform_)
2042 return false; 2043 return false;
2043 return bound_graphics_2d_platform_->PrepareTextureMailbox(mailbox, 2044 return bound_graphics_2d_platform_->PrepareTextureMailbox(mailbox,
2044 release_callback); 2045 release_callback);
2045 } 2046 }
2046 2047
2047 void PepperPluginInstanceImpl::OnDestruct() { render_frame_ = NULL; } 2048 void PepperPluginInstanceImpl::OnDestruct() { render_frame_ = NULL; }
2048 2049
2049 void PepperPluginInstanceImpl::OnThrottleStateChange() { 2050 void PepperPluginInstanceImpl::OnThrottleStateChange() {
2050 SendDidChangeView(); 2051 SendDidChangeView();
2052
2053 bool is_throttled = throttler_->IsThrottled();
2054 render_frame()->Send(new ViewHostMsg_PluginInstanceThrottleStateChange(
2055 module_->GetPluginChildId(), pp_instance_, is_throttled));
2051 } 2056 }
2052 2057
2053 void PepperPluginInstanceImpl::OnHiddenForPlaceholder(bool hidden) { 2058 void PepperPluginInstanceImpl::OnHiddenForPlaceholder(bool hidden) {
2054 if (hidden) { 2059 if (hidden) {
2055 container_->setWebLayer(nullptr); 2060 container_->setWebLayer(nullptr);
2056 } else { 2061 } else {
2057 UpdateLayer(true /* device_changed */); 2062 UpdateLayer(true /* device_changed */);
2058 } 2063 }
2059 } 2064 }
2060 2065
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
3292 3297
3293 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { 3298 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() {
3294 if (initialized_ && !javascript_used_ && is_flash_plugin_) { 3299 if (initialized_ && !javascript_used_ && is_flash_plugin_) {
3295 javascript_used_ = true; 3300 javascript_used_ = true;
3296 RenderThread::Get()->RecordAction( 3301 RenderThread::Get()->RecordAction(
3297 base::UserMetricsAction("Flash.JavaScriptUsed")); 3302 base::UserMetricsAction("Flash.JavaScriptUsed"));
3298 } 3303 }
3299 } 3304 }
3300 3305
3301 } // namespace content 3306 } // namespace content
OLDNEW
« no previous file with comments | « content/common/view_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698