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

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

Issue 707113002: Plugin Power Saver: Refactor Plugin Instance Throttling code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0190-plugin-power-saver-add-some-umas
Patch Set: Created 6 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
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 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_
7 7
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 bool IsMouseLocked(); 680 bool IsMouseLocked();
681 bool LockMouse(); 681 bool LockMouse();
682 MouseLockDispatcher* GetMouseLockDispatcher(); 682 MouseLockDispatcher* GetMouseLockDispatcher();
683 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter(); 683 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter();
684 void UnSetAndDeleteLockTargetAdapter(); 684 void UnSetAndDeleteLockTargetAdapter();
685 685
686 void DidDataFromWebURLResponse(const blink::WebURLResponse& response, 686 void DidDataFromWebURLResponse(const blink::WebURLResponse& response,
687 int pending_host_id, 687 int pending_host_id,
688 const ppapi::URLResponseInfoData& data); 688 const ppapi::URLResponseInfoData& data);
689 689
690 void SetPluginThrottled(bool throttled);
691 void DisablePowerSaverByRetroactiveWhitelist();
692
693 RenderFrameImpl* render_frame_; 690 RenderFrameImpl* render_frame_;
694 base::Closure instance_deleted_callback_; 691 base::Closure instance_deleted_callback_;
695 scoped_refptr<PluginModule> module_; 692 scoped_refptr<PluginModule> module_;
696 scoped_ptr<ppapi::PPP_Instance_Combined> instance_interface_; 693 scoped_ptr<ppapi::PPP_Instance_Combined> instance_interface_;
697 // If this is the NaCl plugin, we create a new module when we switch to the 694 // If this is the NaCl plugin, we create a new module when we switch to the
698 // IPC-based PPAPI proxy. Store the original module and instance interface 695 // IPC-based PPAPI proxy. Store the original module and instance interface
699 // so we can shut down properly. 696 // so we can shut down properly.
700 scoped_refptr<PluginModule> original_module_; 697 scoped_refptr<PluginModule> original_module_;
701 scoped_ptr<ppapi::PPP_Instance_Combined> original_instance_interface_; 698 scoped_ptr<ppapi::PPP_Instance_Combined> original_instance_interface_;
702 699
703 PP_Instance pp_instance_; 700 PP_Instance pp_instance_;
704 701
705 // NULL until we have been initialized. 702 // NULL until we have been initialized.
706 blink::WebPluginContainer* container_; 703 blink::WebPluginContainer* container_;
707 scoped_refptr<cc::Layer> compositor_layer_; 704 scoped_refptr<cc::Layer> compositor_layer_;
708 scoped_refptr<cc::TextureLayer> texture_layer_; 705 scoped_refptr<cc::TextureLayer> texture_layer_;
709 scoped_ptr<blink::WebLayer> web_layer_; 706 scoped_ptr<blink::WebLayer> web_layer_;
710 bool layer_bound_to_fullscreen_; 707 bool layer_bound_to_fullscreen_;
711 bool layer_is_hardware_; 708 bool layer_is_hardware_;
712 709
713 // Plugin URL. 710 // Plugin URL.
714 GURL plugin_url_; 711 GURL plugin_url_;
715 712
716 // Set to true first time plugin is clicked. Used to collect metrics.
717 bool has_been_clicked_;
718
719 // Indicates whether this plugin may be throttled to reduce power consumption.
720 // |power_saver_enabled_| implies |is_peripheral_content_|.
721 bool power_saver_enabled_;
722
723 // Indicates whether this plugin was found to be peripheral content.
724 // This is separately tracked from |power_saver_enabled_| to collect UMAs.
725 // Always true if |power_saver_enabled_| is true.
726 bool is_peripheral_content_;
727
728 // Indicates if the plugin is currently throttled.
729 bool plugin_throttled_;
730
731 // Fake view data used by the Power Saver feature to throttle plugins.
732 const ppapi::ViewData empty_view_data_;
733
734 // Responsible for turning on throttling if Power Saver is on. 713 // Responsible for turning on throttling if Power Saver is on.
735 scoped_ptr<PepperPluginInstanceThrottler> throttler_; 714 scoped_ptr<PepperPluginInstanceThrottler> throttler_;
736 715
737 // Indicates whether this is a full frame instance, which means it represents 716 // Indicates whether this is a full frame instance, which means it represents
738 // an entire document rather than an embed tag. 717 // an entire document rather than an embed tag.
739 bool full_frame_; 718 bool full_frame_;
740 719
741 // Stores the current state of the plugin view. 720 // Stores the current state of the plugin view.
742 ppapi::ViewData view_data_; 721 ppapi::ViewData view_data_;
743 // The last state sent to the plugin. It is only valid after 722 // The last state sent to the plugin. It is only valid after
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 // view change events. 911 // view change events.
933 base::WeakPtrFactory<PepperPluginInstanceImpl> view_change_weak_ptr_factory_; 912 base::WeakPtrFactory<PepperPluginInstanceImpl> view_change_weak_ptr_factory_;
934 base::WeakPtrFactory<PepperPluginInstanceImpl> weak_factory_; 913 base::WeakPtrFactory<PepperPluginInstanceImpl> weak_factory_;
935 914
936 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl); 915 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl);
937 }; 916 };
938 917
939 } // namespace content 918 } // namespace content
940 919
941 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ 920 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698