OLD | NEW |
---|---|
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 PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
6 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 6 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
7 | 7 |
8 #include <map> | |
8 #include <string> | 9 #include <string> |
10 #include <vector> | |
9 | 11 |
10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "base/threading/thread_local_storage.h" | 14 #include "base/threading/thread_local_storage.h" |
13 #include "ppapi/proxy/connection.h" | 15 #include "ppapi/proxy/connection.h" |
14 #include "ppapi/proxy/plugin_resource_tracker.h" | 16 #include "ppapi/proxy/plugin_resource_tracker.h" |
15 #include "ppapi/proxy/plugin_var_tracker.h" | 17 #include "ppapi/proxy/plugin_var_tracker.h" |
16 #include "ppapi/proxy/ppapi_proxy_export.h" | 18 #include "ppapi/proxy/ppapi_proxy_export.h" |
17 #include "ppapi/shared_impl/callback_tracker.h" | 19 #include "ppapi/shared_impl/callback_tracker.h" |
18 #include "ppapi/shared_impl/ppapi_globals.h" | 20 #include "ppapi/shared_impl/ppapi_globals.h" |
21 #include "ui/events/latency_info.h" | |
19 | 22 |
20 namespace base { | 23 namespace base { |
21 class Thread; | 24 class Thread; |
22 } | 25 } |
23 namespace IPC { | 26 namespace IPC { |
24 class Sender; | 27 class Sender; |
25 } | 28 } |
26 | 29 |
27 struct PP_BrowserFont_Trusted_Description; | 30 struct PP_BrowserFont_Trusted_Description; |
28 | 31 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 // is known. This will be used for error logging. | 130 // is known. This will be used for error logging. |
128 void set_plugin_name(const std::string& name) { plugin_name_ = name; } | 131 void set_plugin_name(const std::string& name) { plugin_name_ = name; } |
129 | 132 |
130 // The embedder should call this function when the command line is known. | 133 // The embedder should call this function when the command line is known. |
131 void set_command_line(const std::string& c) { command_line_ = c; } | 134 void set_command_line(const std::string& c) { command_line_ = c; } |
132 | 135 |
133 ResourceReplyThreadRegistrar* resource_reply_thread_registrar() { | 136 ResourceReplyThreadRegistrar* resource_reply_thread_registrar() { |
134 return resource_reply_thread_registrar_.get(); | 137 return resource_reply_thread_registrar_.get(); |
135 } | 138 } |
136 | 139 |
140 // Cache a input event's |latency_info| for the plugin |instance|. | |
141 void AddLatencyInfo(ui::LatencyInfo latency_info, PP_Instance instance); | |
piman
2014/04/25 01:59:43
How about stashing all this state/logic on the Ins
Yufeng Shen (Slow to review)
2014/04/25 20:42:42
All the logic/data are now moved to the host side.
| |
142 // Upon graphics invalidation, input events are considered to have caused | |
143 // rendering damage, their cached latency_info should continue to track | |
144 // the new plugin output frame until it reaches screen. | |
145 void OnGraphicsInvalidation(PP_Instance instance); | |
146 // On graphics flush, the cached latency_info are passed into |latency_info| | |
147 // if they are associated with rendering damage, or terminated if not. | |
148 void OnGraphicsFlush(std::vector<ui::LatencyInfo>* latency_info, | |
149 PP_Instance instance); | |
150 | |
137 // Interval to limit how many IPC messages are sent indicating that the plugin | 151 // Interval to limit how many IPC messages are sent indicating that the plugin |
138 // is active and should be kept alive. The value must be smaller than any | 152 // is active and should be kept alive. The value must be smaller than any |
139 // threshold used to kill inactive plugins by the embedder host. | 153 // threshold used to kill inactive plugins by the embedder host. |
140 void set_keepalive_throttle_interval_milliseconds(unsigned i); | 154 void set_keepalive_throttle_interval_milliseconds(unsigned i); |
141 | 155 |
142 private: | 156 private: |
143 class BrowserSender; | 157 class BrowserSender; |
144 | 158 |
145 // PpapiGlobals overrides. | 159 // PpapiGlobals overrides. |
146 virtual bool IsPluginGlobals() const OVERRIDE; | 160 virtual bool IsPluginGlobals() const OVERRIDE; |
(...skipping 30 matching lines...) Expand all Loading... | |
177 scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_; | 191 scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_; |
178 | 192 |
179 // Indicates activity by the plugin. Used to monitor when a plugin can be | 193 // Indicates activity by the plugin. Used to monitor when a plugin can be |
180 // shutdown due to idleness. Current needs do not require differentiating | 194 // shutdown due to idleness. Current needs do not require differentiating |
181 // between idle state between multiple instances, if any are active they are | 195 // between idle state between multiple instances, if any are active they are |
182 // all considered active. | 196 // all considered active. |
183 bool plugin_recently_active_; | 197 bool plugin_recently_active_; |
184 | 198 |
185 unsigned keepalive_throttle_interval_milliseconds_; | 199 unsigned keepalive_throttle_interval_milliseconds_; |
186 | 200 |
201 // Input event latency that are not associated with any output frame yet. | |
202 std::map<PP_Instance, std::vector<ui::LatencyInfo> > pending_latency_info_; | |
203 // Input event latency that are associated with next output frame. | |
204 std::map<PP_Instance, std::vector<ui::LatencyInfo> > latency_info_for_frame_; | |
205 | |
187 // Member variables should appear before the WeakPtrFactory, see weak_ptr.h. | 206 // Member variables should appear before the WeakPtrFactory, see weak_ptr.h. |
188 base::WeakPtrFactory<PluginGlobals> weak_factory_; | 207 base::WeakPtrFactory<PluginGlobals> weak_factory_; |
189 | 208 |
190 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); | 209 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); |
191 }; | 210 }; |
192 | 211 |
193 } // namespace proxy | 212 } // namespace proxy |
194 } // namespace ppapi | 213 } // namespace ppapi |
195 | 214 |
196 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 215 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
OLD | NEW |