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 UI_COMPOSITOR_COMPOSITOR_H_ | 5 #ifndef UI_COMPOSITOR_COMPOSITOR_H_ |
6 #define UI_COMPOSITOR_COMPOSITOR_H_ | 6 #define UI_COMPOSITOR_COMPOSITOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | |
10 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
14 #include "base/time.h" | 15 #include "base/time.h" |
15 #include "cc/trees/layer_tree_host_client.h" | 16 #include "cc/trees/layer_tree_host_client.h" |
16 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
17 #include "ui/compositor/compositor_export.h" | 18 #include "ui/compositor/compositor_export.h" |
18 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
19 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
34 class GLSurface; | 35 class GLSurface; |
35 class GLShareGroup; | 36 class GLShareGroup; |
36 class Point; | 37 class Point; |
37 class Rect; | 38 class Rect; |
38 } | 39 } |
39 | 40 |
40 namespace WebKit { | 41 namespace WebKit { |
41 class WebGraphicsContext3D; | 42 class WebGraphicsContext3D; |
42 } | 43 } |
43 | 44 |
45 namespace views { | |
46 FORWARD_DECLARE_TEST(ViewLayerTest, DontPaintChildrenWithLayers); | |
47 } | |
48 | |
44 namespace ui { | 49 namespace ui { |
45 | 50 |
46 class Compositor; | 51 class Compositor; |
47 class CompositorObserver; | 52 class CompositorObserver; |
48 class ContextProviderFromContextFactory; | 53 class ContextProviderFromContextFactory; |
49 class Layer; | 54 class Layer; |
50 class PostedSwapQueue; | 55 class PostedSwapQueue; |
51 | 56 |
52 // This class abstracts the creation of the 3D context for the compositor. It is | 57 // This class abstracts the creation of the 3D context for the compositor. It is |
53 // a global object. | 58 // a global object. |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 OffscreenContextProviderForMainThread() OVERRIDE; | 324 OffscreenContextProviderForMainThread() OVERRIDE; |
320 virtual scoped_refptr<cc::ContextProvider> | 325 virtual scoped_refptr<cc::ContextProvider> |
321 OffscreenContextProviderForCompositorThread() OVERRIDE; | 326 OffscreenContextProviderForCompositorThread() OVERRIDE; |
322 | 327 |
323 int last_started_frame() { return last_started_frame_; } | 328 int last_started_frame() { return last_started_frame_; } |
324 int last_ended_frame() { return last_ended_frame_; } | 329 int last_ended_frame() { return last_ended_frame_; } |
325 | 330 |
326 bool IsLocked() { return compositor_lock_ != NULL; } | 331 bool IsLocked() { return compositor_lock_ != NULL; } |
327 | 332 |
328 private: | 333 private: |
334 const int kDrawWaitTimeOutMs = 1000; | |
335 friend class DrawWaiter; | |
piman
2013/04/05 19:28:49
I don't think DrawWaiter needs intimate knowledge
jonathan.backer
2013/04/05 20:08:04
Done.
I think it's much cleaner now. Thanks.
| |
336 | |
337 // Waits at most |kDrawWaitTimeOutMs| milliseconds for a draw to be issued. | |
338 // If a draw is issued in that timeframe, it will complete. Returns true if | |
339 // a draw completed, false otherwise. | |
340 bool WaitForDraw(); | |
341 friend class LayerWithDelegateTest; | |
342 friend class LayerWithRealCompositorTest; | |
343 FRIEND_TEST_ALL_PREFIXES(views::ViewLayerTest, DontPaintChildrenWithLayers); | |
344 | |
329 friend class base::RefCounted<Compositor>; | 345 friend class base::RefCounted<Compositor>; |
330 friend class CompositorLock; | 346 friend class CompositorLock; |
331 | 347 |
332 // Called by CompositorLock. | 348 // Called by CompositorLock. |
333 void UnlockCompositor(); | 349 void UnlockCompositor(); |
334 | 350 |
335 // Called to release any pending CompositorLock | 351 // Called to release any pending CompositorLock |
336 void CancelCompositorLock(); | 352 void CancelCompositorLock(); |
337 | 353 |
338 // Notifies the compositor that compositing is complete. | 354 // Notifies the compositor that compositing is complete. |
(...skipping 24 matching lines...) Expand all Loading... | |
363 bool disable_schedule_composite_; | 379 bool disable_schedule_composite_; |
364 | 380 |
365 CompositorLock* compositor_lock_; | 381 CompositorLock* compositor_lock_; |
366 | 382 |
367 DISALLOW_COPY_AND_ASSIGN(Compositor); | 383 DISALLOW_COPY_AND_ASSIGN(Compositor); |
368 }; | 384 }; |
369 | 385 |
370 } // namespace ui | 386 } // namespace ui |
371 | 387 |
372 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 388 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |