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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.h

Issue 10690168: Aura: Resize locks with --ui-enable-threaded-compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: New approach. Created 8 years, 4 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 | Annotate | Revision Log
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_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
7 7
8 #include <map> 8 #include <map>
9 #include <utility>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "content/browser/renderer_host/image_transport_factory.h" 16 #include "content/browser/renderer_host/image_transport_factory.h"
16 #include "content/browser/renderer_host/render_widget_host_view_base.h" 17 #include "content/browser/renderer_host/render_widget_host_view_base.h"
17 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
18 #include "ui/aura/client/activation_delegate.h" 19 #include "ui/aura/client/activation_delegate.h"
19 #include "ui/aura/window_delegate.h" 20 #include "ui/aura/window_delegate.h"
20 #include "ui/base/ime/text_input_client.h" 21 #include "ui/base/ime/text_input_client.h"
21 #include "ui/compositor/compositor_observer.h" 22 #include "ui/compositor/compositor_observer.h"
22 #include "ui/gfx/rect.h" 23 #include "ui/gfx/rect.h"
23 #include "webkit/glue/webcursor.h" 24 #include "webkit/glue/webcursor.h"
24 25
25 namespace aura { 26 namespace aura {
26 class CompositorLock; 27 class CompositorLock;
27 } 28 }
28 29
29 namespace gfx { 30 namespace gfx {
30 class Canvas; 31 class Canvas;
31 } 32 }
32 33
33 namespace ui { 34 namespace ui {
35 class CompositorLock;
34 class InputMethod; 36 class InputMethod;
35 class Texture; 37 class Texture;
36 } 38 }
37 39
38 namespace WebKit { 40 namespace WebKit {
39 class WebTouchEvent; 41 class WebTouchEvent;
40 } 42 }
41 43
42 namespace content { 44 namespace content {
43 class RenderWidgetHostImpl; 45 class RenderWidgetHostImpl;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 friend class RenderWidgetHostView; 189 friend class RenderWidgetHostView;
188 190
189 // Should construct only via RenderWidgetHostView::CreateViewForWidget. 191 // Should construct only via RenderWidgetHostView::CreateViewForWidget.
190 explicit RenderWidgetHostViewAura(RenderWidgetHost* host); 192 explicit RenderWidgetHostViewAura(RenderWidgetHost* host);
191 193
192 private: 194 private:
193 class WindowObserver; 195 class WindowObserver;
194 friend class WindowObserver; 196 friend class WindowObserver;
195 197
196 // Overridden from ui::CompositorObserver: 198 // Overridden from ui::CompositorObserver:
197 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE;
198 virtual void OnCompositingWillStart(ui::Compositor* compositor) OVERRIDE;
199 virtual void OnCompositingStarted(ui::Compositor* compositor) OVERRIDE; 199 virtual void OnCompositingStarted(ui::Compositor* compositor) OVERRIDE;
200 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE; 200 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE;
201 virtual void OnCompositingAborted(ui::Compositor* compositor) OVERRIDE; 201 virtual void OnCompositingAborted(ui::Compositor* compositor) OVERRIDE;
202 202
203 // Overridden from ImageTransportFactoryObserver: 203 // Overridden from ImageTransportFactoryObserver:
204 virtual void OnLostResources(ui::Compositor* compositor) OVERRIDE; 204 virtual void OnLostResources(ui::Compositor* compositor) OVERRIDE;
205 205
206 virtual ~RenderWidgetHostViewAura(); 206 virtual ~RenderWidgetHostViewAura();
207 207
208 void UpdateCursorIfOverSelf(); 208 void UpdateCursorIfOverSelf();
209 void UpdateExternalTexture(); 209 void UpdateExternalTexture();
210
211 // Given the size of the latest accelerated surface from the renderer,
212 // deactivate and remove spent locks.
213 void UpdateResizeLocks(const gfx::Size& surface_size_in_dip);
214
215 // Returns true if no pending resize locks have timed-out and
216 // there is more than one active resize lock pending.
217 bool CanFastTrackACK(const gfx::Size& surface_size_in_dip);
218
210 ui::InputMethod* GetInputMethod() const; 219 ui::InputMethod* GetInputMethod() const;
211 220
212 // Returns whether the widget needs an input grab to work properly. 221 // Returns whether the widget needs an input grab to work properly.
213 bool NeedsInputGrab(); 222 bool NeedsInputGrab();
214 223
215 // Confirm existing composition text in the webpage and ask the input method 224 // Confirm existing composition text in the webpage and ask the input method
216 // to cancel its ongoing composition session. 225 // to cancel its ongoing composition session.
217 void FinishImeCompositionSession(); 226 void FinishImeCompositionSession();
218 227
219 // This method computes movementX/Y and keeps track of mouse location for 228 // This method computes movementX/Y and keeps track of mouse location for
220 // mouse lock on all mouse move events. 229 // mouse lock on all mouse move events.
221 void ModifyEventMovementAndCoords(WebKit::WebMouseEvent* event); 230 void ModifyEventMovementAndCoords(WebKit::WebMouseEvent* event);
222 231
223 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty 232 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
224 // SchedulePaint() is invoked for |rect|. 233 // SchedulePaint() is invoked for |rect|.
225 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); 234 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
226 235
227 // Helper method to determine if, in mouse locked mode, the cursor should be 236 // Helper method to determine if, in mouse locked mode, the cursor should be
228 // moved to center. 237 // moved to center.
229 bool ShouldMoveToCenter(); 238 bool ShouldMoveToCenter();
230 239
231 // Run the compositing callbacks. 240 void RunCompositingStartedCallbacks(ui::Compositor* compositor);
232 void RunCompositingDidCommitCallbacks(ui::Compositor* compositor); 241
233 void RunCompositingWillStartCallbacks(ui::Compositor* compositor); 242 // Add a callback that waits for a commit and the start of a draw.
243 void AddCompositingStartedCallback(
244 base::Callback<void(ui::Compositor*)> callback);
234 245
235 // Insert a sync point into the compositor's command stream and acknowledge 246 // Insert a sync point into the compositor's command stream and acknowledge
236 // that we have presented the accelerated surface buffer. 247 // that we have presented the accelerated surface buffer.
237 static void InsertSyncPointAndACK(int32 route_id, 248 static void InsertSyncPointAndACK(int32 route_id,
238 int gpu_host_id, 249 int gpu_host_id,
239 ui::Compositor* compositor); 250 ui::Compositor* compositor);
240 251
241 // Called when window_ is removed from the window tree. 252 // Called when window_ is removed from the window tree.
242 void RemovingFromRootWindow(); 253 void RemovingFromRootWindow();
243 254
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 320
310 // Indicates if there is onging composition text. 321 // Indicates if there is onging composition text.
311 bool has_composition_text_; 322 bool has_composition_text_;
312 323
313 // Current tooltip text. 324 // Current tooltip text.
314 string16 tooltip_; 325 string16 tooltip_;
315 326
316 std::vector< base::Callback<void(ui::Compositor*)> > 327 std::vector< base::Callback<void(ui::Compositor*)> >
317 on_compositing_did_commit_callbacks_; 328 on_compositing_did_commit_callbacks_;
318 329
319 std::vector< base::Callback<void(ui::Compositor*)> > 330 typedef std::pair<int, base::Callback<void(ui::Compositor*)> >
320 on_compositing_will_start_callbacks_; 331 CommitIdAndCallback;
332 std::vector<CommitIdAndCallback> on_compositing_started_callbacks_;
321 333
322 std::map<uint64, scoped_refptr<ui::Texture> > 334 std::map<uint64, scoped_refptr<ui::Texture> >
323 image_transport_clients_; 335 image_transport_clients_;
324 336
325 uint64 current_surface_; 337 uint64 current_surface_;
326 338
327 // Protected means that the |current_surface_| may be in use by ui and cannot 339 // Protected means that the |current_surface_| may be in use by ui and cannot
328 // be safely discarded. Things to consider are thumbnailer, compositor draw, 340 // be safely discarded. Things to consider are thumbnailer, compositor draw,
329 // and tab visibility. 341 // and tab visibility.
330 bool current_surface_is_protected_; 342 bool current_surface_is_protected_;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 377
366 // Used to prevent further resizes while a resize is pending. 378 // Used to prevent further resizes while a resize is pending.
367 class ResizeLock; 379 class ResizeLock;
368 // These locks are the ones waiting for a texture of the right size to come 380 // These locks are the ones waiting for a texture of the right size to come
369 // back from the renderer/GPU process. 381 // back from the renderer/GPU process.
370 std::vector<linked_ptr<ResizeLock> > resize_locks_; 382 std::vector<linked_ptr<ResizeLock> > resize_locks_;
371 // These locks are the ones waiting for a frame to be drawn. 383 // These locks are the ones waiting for a frame to be drawn.
372 std::vector<linked_ptr<ResizeLock> > locks_pending_draw_; 384 std::vector<linked_ptr<ResizeLock> > locks_pending_draw_;
373 385
374 // This lock is for waiting for a front surface to become available to draw. 386 // This lock is for waiting for a front surface to become available to draw.
375 scoped_refptr<aura::CompositorLock> released_front_lock_; 387 scoped_refptr<ui::CompositorLock> released_front_lock_;
376 388
377 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); 389 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
378 }; 390 };
379 391
380 } // namespace content 392 } // namespace content
381 393
382 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 394 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698