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

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

Issue 866173002: Plugin Power Saver: Add UI Overlay to throttled plugin using placeholder. (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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 16 matching lines...) Expand all
27 PluginInstanceThrottlerImpl(RenderFrame* frame, 27 PluginInstanceThrottlerImpl(RenderFrame* frame,
28 const GURL& plugin_url, 28 const GURL& plugin_url,
29 bool power_saver_enabled); 29 bool power_saver_enabled);
30 30
31 ~PluginInstanceThrottlerImpl() override; 31 ~PluginInstanceThrottlerImpl() override;
32 32
33 // PluginInstanceThrottler implementation: 33 // PluginInstanceThrottler implementation:
34 void AddObserver(Observer* observer) override; 34 void AddObserver(Observer* observer) override;
35 void RemoveObserver(Observer* observer) override; 35 void RemoveObserver(Observer* observer) override;
36 bool IsThrottled() const override; 36 bool IsThrottled() const override;
37 bool IsHiddenForPlaceholder() const override;
37 void MarkPluginEssential(PowerSaverUnthrottleMethod method) override; 38 void MarkPluginEssential(PowerSaverUnthrottleMethod method) override;
39 void SetHiddenForPlaceholder(bool hidden) override;
38 40
39 bool needs_representative_keyframe() const { 41 bool needs_representative_keyframe() const {
40 return state_ == POWER_SAVER_ENABLED_AWAITING_KEYFRAME; 42 return state_ == POWER_SAVER_ENABLED_AWAITING_KEYFRAME;
41 } 43 }
42 44
43 bool power_saver_enabled() const { 45 bool power_saver_enabled() const {
44 return state_ == POWER_SAVER_ENABLED_AWAITING_KEYFRAME || 46 return state_ == POWER_SAVER_ENABLED_AWAITING_KEYFRAME ||
45 state_ == POWER_SAVER_ENABLED_PLUGIN_THROTTLED; 47 state_ == POWER_SAVER_ENABLED_PLUGIN_THROTTLED;
46 } 48 }
47 49
(...skipping 15 matching lines...) Expand all
63 // We've chosen a keyframe and the plug-in is throttled. 65 // We've chosen a keyframe and the plug-in is throttled.
64 POWER_SAVER_ENABLED_PLUGIN_THROTTLED, 66 POWER_SAVER_ENABLED_PLUGIN_THROTTLED,
65 // Plugin instance is no longer considered peripheral. This can happen from 67 // Plugin instance is no longer considered peripheral. This can happen from
66 // a user click, whitelisting, or some other reason. We can end up in this 68 // a user click, whitelisting, or some other reason. We can end up in this
67 // state regardless of whether power saver is enabled. 69 // state regardless of whether power saver is enabled.
68 PLUGIN_INSTANCE_MARKED_ESSENTIAL 70 PLUGIN_INSTANCE_MARKED_ESSENTIAL
69 }; 71 };
70 72
71 void EngageThrottle(); 73 void EngageThrottle();
72 74
75 void TimeoutKeyframeExtraction();
76
73 State state_; 77 State state_;
74 78
79 bool is_hidden_for_placeholder_;
80
75 // Number of consecutive interesting frames we've encountered. 81 // Number of consecutive interesting frames we've encountered.
76 int consecutive_interesting_frames_; 82 int consecutive_interesting_frames_;
77 83
84 // If true, take the next frame as the keyframe regardless of interestingness.
85 bool keyframe_extraction_timed_out_;
86
78 ObserverList<Observer> observer_list_; 87 ObserverList<Observer> observer_list_;
79 88
80 base::WeakPtrFactory<PluginInstanceThrottlerImpl> weak_factory_; 89 base::WeakPtrFactory<PluginInstanceThrottlerImpl> weak_factory_;
81 90
82 DISALLOW_COPY_AND_ASSIGN(PluginInstanceThrottlerImpl); 91 DISALLOW_COPY_AND_ASSIGN(PluginInstanceThrottlerImpl);
83 }; 92 };
84 } 93 }
85 94
86 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ 95 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.cc ('k') | content/renderer/pepper/plugin_instance_throttler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698