Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ | 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/synchronization/waitable_event.h" | |
| 13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 14 #include "cc/resources/returned_resource.h" | 15 #include "cc/resources/returned_resource.h" |
| 15 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 16 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 17 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
| 18 | 19 |
| 19 class SkCanvas; | 20 class SkCanvas; |
| 20 | 21 |
| 21 namespace cc { | 22 namespace cc { |
| 22 class CompositorFrame; | 23 class CompositorFrame; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 52 Frame(Frame&& rhs); | 53 Frame(Frame&& rhs); |
| 53 Frame& operator=(Frame&& rhs); | 54 Frame& operator=(Frame&& rhs); |
| 54 | 55 |
| 55 uint32_t compositor_frame_sink_id; | 56 uint32_t compositor_frame_sink_id; |
| 56 std::unique_ptr<cc::CompositorFrame> frame; | 57 std::unique_ptr<cc::CompositorFrame> frame; |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(Frame); | 60 DISALLOW_COPY_AND_ASSIGN(Frame); |
| 60 }; | 61 }; |
| 61 | 62 |
| 63 class FrameFuture : public base::RefCountedThreadSafe<FrameFuture> { | |
| 64 public: | |
| 65 FrameFuture(); | |
| 66 void setFrame(std::unique_ptr<Frame> frame); | |
| 67 std::unique_ptr<Frame> getFrame(); | |
| 68 | |
| 69 private: | |
| 70 base::WaitableEvent waitable_event_; | |
|
boliu
2016/09/22 23:05:32
ordering style:
friend, then destructor, then bla
ojars
2016/09/28 00:17:59
Done.
| |
| 71 std::unique_ptr<Frame> frame_; | |
| 72 friend class base::RefCountedThreadSafe<FrameFuture>; | |
| 73 ~FrameFuture(); | |
| 74 #if DCHECK_IS_ON() | |
| 75 bool waited_ = false; | |
| 76 #endif | |
| 77 }; | |
| 78 | |
| 62 // "On demand" hardware draw. Parameters are used by compositor for this draw. | 79 // "On demand" hardware draw. Parameters are used by compositor for this draw. |
| 63 // |viewport_size| is the current size to improve results during resize. | 80 // |viewport_size| is the current size to improve results during resize. |
| 64 // |viewport_rect_for_tile_priority| and |transform_for_tile_priority| are | 81 // |viewport_rect_for_tile_priority| and |transform_for_tile_priority| are |
| 65 // used to customize the tiling decisions of compositor. | 82 // used to customize the tiling decisions of compositor. |
| 66 virtual Frame DemandDrawHw( | 83 // TODO(ojars): update this and the next documentation |
|
boliu
2016/09/22 23:05:32
no change required anymore :p
ojars
2016/09/28 00:17:59
Done.
| |
| 84 virtual SynchronousCompositor::Frame DemandDrawHw( | |
|
boliu
2016/09/22 23:05:32
don't need the SynchronousCompositor:: part
ojars
2016/09/28 00:17:59
Done.
| |
| 67 const gfx::Size& viewport_size, | 85 const gfx::Size& viewport_size, |
| 68 const gfx::Rect& viewport_rect_for_tile_priority, | 86 const gfx::Rect& viewport_rect_for_tile_priority, |
| 69 const gfx::Transform& transform_for_tile_priority) = 0; | 87 const gfx::Transform& transform_for_tile_priority) = 0; |
| 70 | 88 |
| 71 // Same as DemandDrawHw, but uses asynchronous IPC messages. Calls | 89 // Same as DemandDrawHw, but uses asynchronous IPC messages. Calls |
| 72 // SynchronousCompositorClient::OnDrawHardwareProcessFrame to return the | 90 // SynchronousCompositorClient::OnDrawHardwareProcessFrame to return the |
| 73 // frame. | 91 // frame. |
| 74 virtual void DemandDrawHwAsync( | 92 virtual void DemandDrawHwAsync( |
| 75 const gfx::Size& viewport_size, | 93 const gfx::Size& viewport_size, |
| 76 const gfx::Rect& viewport_rect_for_tile_priority, | 94 const gfx::Rect& viewport_rect_for_tile_priority, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 102 // and if any input animation is active, it should tick now. | 120 // and if any input animation is active, it should tick now. |
| 103 virtual void OnComputeScroll(base::TimeTicks animation_time) = 0; | 121 virtual void OnComputeScroll(base::TimeTicks animation_time) = 0; |
| 104 | 122 |
| 105 protected: | 123 protected: |
| 106 virtual ~SynchronousCompositor() {} | 124 virtual ~SynchronousCompositor() {} |
| 107 }; | 125 }; |
| 108 | 126 |
| 109 } // namespace content | 127 } // namespace content |
| 110 | 128 |
| 111 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ | 129 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ |
| OLD | NEW |