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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_output_surface.h

Issue 240163005: Deliver IPC messages together with SwapCompositorFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable browsertest for android for realz this time Created 6 years, 5 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 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_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE _H_ 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE _H_
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE _H_ 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE _H_
7 7
8 #include <vector>
9
8 #include "base/basictypes.h" 10 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
12 #include "cc/output/compositor_frame.h" 14 #include "cc/output/compositor_frame.h"
13 #include "cc/output/managed_memory_policy.h" 15 #include "cc/output/managed_memory_policy.h"
14 #include "cc/output/output_surface.h" 16 #include "cc/output/output_surface.h"
15 #include "content/public/browser/android/synchronous_compositor.h" 17 #include "content/public/browser/android/synchronous_compositor.h"
18 #include "ipc/ipc_message.h"
16 #include "ui/gfx/transform.h" 19 #include "ui/gfx/transform.h"
17 20
18 namespace cc { 21 namespace cc {
19 class ContextProvider; 22 class ContextProvider;
20 class CompositorFrameMetadata; 23 class CompositorFrameMetadata;
21 } 24 }
22 25
26 namespace IPC {
27 class Message;
28 }
29
23 namespace content { 30 namespace content {
24 31
32 class FrameSwapMessageQueue;
25 class SynchronousCompositorClient; 33 class SynchronousCompositorClient;
26 class SynchronousCompositorOutputSurface; 34 class SynchronousCompositorOutputSurface;
27 class WebGraphicsContext3DCommandBufferImpl; 35 class WebGraphicsContext3DCommandBufferImpl;
28 36
29 class SynchronousCompositorOutputSurfaceDelegate { 37 class SynchronousCompositorOutputSurfaceDelegate {
30 public: 38 public:
31 virtual void DidBindOutputSurface( 39 virtual void DidBindOutputSurface(
32 SynchronousCompositorOutputSurface* output_surface) = 0; 40 SynchronousCompositorOutputSurface* output_surface) = 0;
33 virtual void DidDestroySynchronousOutputSurface( 41 virtual void DidDestroySynchronousOutputSurface(
34 SynchronousCompositorOutputSurface* output_surface) = 0; 42 SynchronousCompositorOutputSurface* output_surface) = 0;
35 virtual void SetContinuousInvalidate(bool enable) = 0; 43 virtual void SetContinuousInvalidate(bool enable) = 0;
36 virtual void DidActivatePendingTree() = 0; 44 virtual void DidActivatePendingTree() = 0;
37 45
38 protected: 46 protected:
39 SynchronousCompositorOutputSurfaceDelegate() {} 47 SynchronousCompositorOutputSurfaceDelegate() {}
40 virtual ~SynchronousCompositorOutputSurfaceDelegate() {} 48 virtual ~SynchronousCompositorOutputSurfaceDelegate() {}
41 }; 49 };
42 50
43 // Specialization of the output surface that adapts it to implement the 51 // Specialization of the output surface that adapts it to implement the
44 // content::SynchronousCompositor public API. This class effects an "inversion 52 // content::SynchronousCompositor public API. This class effects an "inversion
45 // of control" - enabling drawing to be orchestrated by the embedding 53 // of control" - enabling drawing to be orchestrated by the embedding
46 // layer, instead of driven by the compositor internals - hence it holds two 54 // layer, instead of driven by the compositor internals - hence it holds two
47 // 'client' pointers (|client_| in the OutputSurface baseclass and 55 // 'client' pointers (|client_| in the OutputSurface baseclass and
48 // GetDelegate()) which represent the consumers of the two roles in plays. 56 // GetDelegate()) which represent the consumers of the two roles in plays.
49 // This class can be created only on the main thread, but then becomes pinned 57 // This class can be created only on the main thread, but then becomes pinned
50 // to a fixed thread when BindToClient is called. 58 // to a fixed thread when BindToClient is called.
51 class SynchronousCompositorOutputSurface 59 class SynchronousCompositorOutputSurface
52 : NON_EXPORTED_BASE(public cc::OutputSurface) { 60 : NON_EXPORTED_BASE(public cc::OutputSurface) {
53 public: 61 public:
54 explicit SynchronousCompositorOutputSurface(int routing_id); 62 explicit SynchronousCompositorOutputSurface(
63 int routing_id,
64 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue);
55 virtual ~SynchronousCompositorOutputSurface(); 65 virtual ~SynchronousCompositorOutputSurface();
56 66
57 // OutputSurface. 67 // OutputSurface.
58 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE; 68 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE;
59 virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE; 69 virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE;
60 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; 70 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE;
61 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; 71 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE;
62 72
63 // Partial SynchronousCompositor API implementation. 73 // Partial SynchronousCompositor API implementation.
64 bool InitializeHwDraw( 74 bool InitializeHwDraw(
65 scoped_refptr<cc::ContextProvider> onscreen_context_provider); 75 scoped_refptr<cc::ContextProvider> onscreen_context_provider);
66 void ReleaseHwDraw(); 76 void ReleaseHwDraw();
67 scoped_ptr<cc::CompositorFrame> DemandDrawHw(gfx::Size surface_size, 77 scoped_ptr<cc::CompositorFrame> DemandDrawHw(gfx::Size surface_size,
68 const gfx::Transform& transform, 78 const gfx::Transform& transform,
69 gfx::Rect viewport, 79 gfx::Rect viewport,
70 gfx::Rect clip); 80 gfx::Rect clip);
71 void ReturnResources(const cc::CompositorFrameAck& frame_ack); 81 void ReturnResources(const cc::CompositorFrameAck& frame_ack);
72 scoped_ptr<cc::CompositorFrame> DemandDrawSw(SkCanvas* canvas); 82 scoped_ptr<cc::CompositorFrame> DemandDrawSw(SkCanvas* canvas);
73 void SetMemoryPolicy(const SynchronousCompositorMemoryPolicy& policy); 83 void SetMemoryPolicy(const SynchronousCompositorMemoryPolicy& policy);
84 void GetMessagesToDeliver(ScopedVector<IPC::Message>* messages);
74 85
75 private: 86 private:
76 class SoftwareDevice; 87 class SoftwareDevice;
77 friend class SoftwareDevice; 88 friend class SoftwareDevice;
78 89
79 void InvokeComposite(const gfx::Transform& transform, 90 void InvokeComposite(const gfx::Transform& transform,
80 gfx::Rect viewport, 91 gfx::Rect viewport,
81 gfx::Rect clip, 92 gfx::Rect clip,
82 bool hardware_draw); 93 bool hardware_draw);
83 bool CalledOnValidThread() const; 94 bool CalledOnValidThread() const;
84 SynchronousCompositorOutputSurfaceDelegate* GetDelegate(); 95 SynchronousCompositorOutputSurfaceDelegate* GetDelegate();
85 96
86 int routing_id_; 97 int routing_id_;
87 bool needs_begin_frame_; 98 bool needs_begin_frame_;
88 bool invoking_composite_; 99 bool invoking_composite_;
89 100
90 gfx::Transform cached_hw_transform_; 101 gfx::Transform cached_hw_transform_;
91 gfx::Rect cached_hw_viewport_; 102 gfx::Rect cached_hw_viewport_;
92 gfx::Rect cached_hw_clip_; 103 gfx::Rect cached_hw_clip_;
93 104
94 // Only valid (non-NULL) during a DemandDrawSw() call. 105 // Only valid (non-NULL) during a DemandDrawSw() call.
95 SkCanvas* current_sw_canvas_; 106 SkCanvas* current_sw_canvas_;
96 107
97 cc::ManagedMemoryPolicy memory_policy_; 108 cc::ManagedMemoryPolicy memory_policy_;
98 109
99 cc::OutputSurfaceClient* output_surface_client_; 110 cc::OutputSurfaceClient* output_surface_client_;
100 scoped_ptr<cc::CompositorFrame> frame_holder_; 111 scoped_ptr<cc::CompositorFrame> frame_holder_;
101 112
113 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
114
102 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); 115 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface);
103 }; 116 };
104 117
105 } // namespace content 118 } // namespace content
106 119
107 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF ACE_H_ 120 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF ACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698