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

Side by Side Diff: content/public/browser/android/synchronous_compositor.h

Issue 2347563003: Added FrameFuture class (Closed)
Patch Set: Code review Created 4 years, 3 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 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
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<SynchronousCompositor::Frame> frame);
67 SynchronousCompositor::Frame* getFrame();
68 void Wait();
boliu 2016/09/20 00:27:56 there should be no Wait or hasFrame, and getFrame
ojars 2016/09/22 18:21:39 Done.
69 bool hasFrame();
70
71 private:
72 base::WaitableEvent waitable_event_;
73 std::unique_ptr<content::SynchronousCompositor::Frame> frame_;
74 friend class base::RefCountedThreadSafe<FrameFuture>;
75 ~FrameFuture();
76 };
77
62 // "On demand" hardware draw. Parameters are used by compositor for this draw. 78 // "On demand" hardware draw. Parameters are used by compositor for this draw.
63 // |viewport_size| is the current size to improve results during resize. 79 // |viewport_size| is the current size to improve results during resize.
64 // |viewport_rect_for_tile_priority| and |transform_for_tile_priority| are 80 // |viewport_rect_for_tile_priority| and |transform_for_tile_priority| are
65 // used to customize the tiling decisions of compositor. 81 // used to customize the tiling decisions of compositor.
66 virtual Frame DemandDrawHw( 82 // TODO(ojars): update this and the next documentation
83 virtual scoped_refptr<FrameFuture> DemandDrawHw(
67 const gfx::Size& viewport_size, 84 const gfx::Size& viewport_size,
68 const gfx::Rect& viewport_rect_for_tile_priority, 85 const gfx::Rect& viewport_rect_for_tile_priority,
69 const gfx::Transform& transform_for_tile_priority) = 0; 86 const gfx::Transform& transform_for_tile_priority) = 0;
70 87
71 // Same as DemandDrawHw, but uses asynchronous IPC messages. Calls 88 // Same as DemandDrawHw, but uses asynchronous IPC messages. Calls
72 // SynchronousCompositorClient::OnDrawHardwareProcessFrame to return the 89 // SynchronousCompositorClient::OnDrawHardwareProcessFrame to return the
73 // frame. 90 // frame.
74 virtual void DemandDrawHwAsync( 91 virtual scoped_refptr<FrameFuture> DemandDrawHwAsync(
75 const gfx::Size& viewport_size, 92 const gfx::Size& viewport_size,
76 const gfx::Rect& viewport_rect_for_tile_priority, 93 const gfx::Rect& viewport_rect_for_tile_priority,
77 const gfx::Transform& transform_for_tile_priority) = 0; 94 const gfx::Transform& transform_for_tile_priority) = 0;
78 95
79 // For delegated rendering, return resources from parent compositor to this. 96 // For delegated rendering, return resources from parent compositor to this.
80 // Note that all resources must be returned before ReleaseHwDraw. 97 // Note that all resources must be returned before ReleaseHwDraw.
81 virtual void ReturnResources(uint32_t compositor_frame_sink_id, 98 virtual void ReturnResources(uint32_t compositor_frame_sink_id,
82 const cc::ReturnedResourceArray& resources) = 0; 99 const cc::ReturnedResourceArray& resources) = 0;
83 100
84 // "On demand" SW draw, into the supplied canvas (observing the transform 101 // "On demand" SW draw, into the supplied canvas (observing the transform
(...skipping 17 matching lines...) Expand all
102 // and if any input animation is active, it should tick now. 119 // and if any input animation is active, it should tick now.
103 virtual void OnComputeScroll(base::TimeTicks animation_time) = 0; 120 virtual void OnComputeScroll(base::TimeTicks animation_time) = 0;
104 121
105 protected: 122 protected:
106 virtual ~SynchronousCompositor() {} 123 virtual ~SynchronousCompositor() {}
107 }; 124 };
108 125
109 } // namespace content 126 } // namespace content
110 127
111 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ 128 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698