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

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: who needs a frame number Created 6 years, 7 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/managed_memory_policy.h" 14 #include "cc/output/managed_memory_policy.h"
13 #include "cc/output/output_surface.h" 15 #include "cc/output/output_surface.h"
14 #include "content/public/browser/android/synchronous_compositor.h" 16 #include "content/public/browser/android/synchronous_compositor.h"
17 #include "ipc/ipc_message.h"
15 #include "ui/gfx/transform.h" 18 #include "ui/gfx/transform.h"
16 19
17 namespace cc { 20 namespace cc {
18 class ContextProvider; 21 class ContextProvider;
19 class CompositorFrameMetadata; 22 class CompositorFrameMetadata;
20 } 23 }
21 24
25 namespace IPC {
26 class Message;
27 }
28
22 namespace content { 29 namespace content {
23 30
31 class FrameSwapMessageQueue;
24 class SynchronousCompositorClient; 32 class SynchronousCompositorClient;
25 class SynchronousCompositorOutputSurface; 33 class SynchronousCompositorOutputSurface;
26 class WebGraphicsContext3DCommandBufferImpl; 34 class WebGraphicsContext3DCommandBufferImpl;
27 35
28 class SynchronousCompositorOutputSurfaceDelegate { 36 class SynchronousCompositorOutputSurfaceDelegate {
29 public: 37 public:
30 virtual void DidBindOutputSurface( 38 virtual void DidBindOutputSurface(
31 SynchronousCompositorOutputSurface* output_surface) = 0; 39 SynchronousCompositorOutputSurface* output_surface) = 0;
32 virtual void DidDestroySynchronousOutputSurface( 40 virtual void DidDestroySynchronousOutputSurface(
33 SynchronousCompositorOutputSurface* output_surface) = 0; 41 SynchronousCompositorOutputSurface* output_surface) = 0;
34 virtual void SetContinuousInvalidate(bool enable) = 0; 42 virtual void SetContinuousInvalidate(bool enable) = 0;
35 virtual void UpdateFrameMetaData( 43 virtual void UpdateFrameMetaData(
36 const cc::CompositorFrameMetadata& frame_metadata) = 0; 44 const cc::CompositorFrameMetadata& frame_metadata) = 0;
45 virtual void DeliverMessages(const std::vector<IPC::Message>& messages) = 0;
37 virtual void DidActivatePendingTree() = 0; 46 virtual void DidActivatePendingTree() = 0;
38 47
39 protected: 48 protected:
40 SynchronousCompositorOutputSurfaceDelegate() {} 49 SynchronousCompositorOutputSurfaceDelegate() {}
41 virtual ~SynchronousCompositorOutputSurfaceDelegate() {} 50 virtual ~SynchronousCompositorOutputSurfaceDelegate() {}
42 }; 51 };
43 52
44 // Specialization of the output surface that adapts it to implement the 53 // Specialization of the output surface that adapts it to implement the
45 // content::SynchronousCompositor public API. This class effects an "inversion 54 // content::SynchronousCompositor public API. This class effects an "inversion
46 // of control" - enabling drawing to be orchestrated by the embedding 55 // of control" - enabling drawing to be orchestrated by the embedding
47 // layer, instead of driven by the compositor internals - hence it holds two 56 // layer, instead of driven by the compositor internals - hence it holds two
48 // 'client' pointers (|client_| in the OutputSurface baseclass and 57 // 'client' pointers (|client_| in the OutputSurface baseclass and
49 // GetDelegate()) which represent the consumers of the two roles in plays. 58 // GetDelegate()) which represent the consumers of the two roles in plays.
50 // This class can be created only on the main thread, but then becomes pinned 59 // This class can be created only on the main thread, but then becomes pinned
51 // to a fixed thread when BindToClient is called. 60 // to a fixed thread when BindToClient is called.
52 class SynchronousCompositorOutputSurface 61 class SynchronousCompositorOutputSurface
53 : NON_EXPORTED_BASE(public cc::OutputSurface) { 62 : NON_EXPORTED_BASE(public cc::OutputSurface) {
54 public: 63 public:
55 explicit SynchronousCompositorOutputSurface(int routing_id); 64 explicit SynchronousCompositorOutputSurface(
65 int routing_id,
66 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue);
56 virtual ~SynchronousCompositorOutputSurface(); 67 virtual ~SynchronousCompositorOutputSurface();
57 68
58 // OutputSurface. 69 // OutputSurface.
59 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; 70 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE;
60 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE; 71 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE;
61 virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE; 72 virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE;
62 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; 73 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE;
63 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; 74 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE;
64 75
65 // Partial SynchronousCompositor API implementation. 76 // Partial SynchronousCompositor API implementation.
(...skipping 12 matching lines...) Expand all
78 class SoftwareDevice; 89 class SoftwareDevice;
79 friend class SoftwareDevice; 90 friend class SoftwareDevice;
80 91
81 void InvokeComposite(const gfx::Transform& transform, 92 void InvokeComposite(const gfx::Transform& transform,
82 gfx::Rect viewport, 93 gfx::Rect viewport,
83 gfx::Rect clip, 94 gfx::Rect clip,
84 bool valid_for_tile_management); 95 bool valid_for_tile_management);
85 bool CalledOnValidThread() const; 96 bool CalledOnValidThread() const;
86 SynchronousCompositorOutputSurfaceDelegate* GetDelegate(); 97 SynchronousCompositorOutputSurfaceDelegate* GetDelegate();
87 void UpdateFrameMetaData(const cc::CompositorFrameMetadata& frame_info); 98 void UpdateFrameMetaData(const cc::CompositorFrameMetadata& frame_info);
99 void DeliverMessages(const std::vector<IPC::Message>& messages);
88 100
89 int routing_id_; 101 int routing_id_;
90 bool needs_begin_frame_; 102 bool needs_begin_frame_;
91 bool invoking_composite_; 103 bool invoking_composite_;
92 bool did_swap_buffer_; 104 bool did_swap_buffer_;
93 105
94 gfx::Transform cached_hw_transform_; 106 gfx::Transform cached_hw_transform_;
95 gfx::Rect cached_hw_viewport_; 107 gfx::Rect cached_hw_viewport_;
96 gfx::Rect cached_hw_clip_; 108 gfx::Rect cached_hw_clip_;
97 109
98 // Only valid (non-NULL) during a DemandDrawSw() call. 110 // Only valid (non-NULL) during a DemandDrawSw() call.
99 SkCanvas* current_sw_canvas_; 111 SkCanvas* current_sw_canvas_;
100 112
101 cc::ManagedMemoryPolicy memory_policy_; 113 cc::ManagedMemoryPolicy memory_policy_;
102 114
103 cc::OutputSurfaceClient* output_surface_client_; 115 cc::OutputSurfaceClient* output_surface_client_;
104 116
117 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
118
105 base::WeakPtrFactory<SynchronousCompositorOutputSurface> weak_ptr_factory_; 119 base::WeakPtrFactory<SynchronousCompositorOutputSurface> weak_ptr_factory_;
106 120
107 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); 121 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface);
108 }; 122 };
109 123
110 } // namespace content 124 } // namespace content
111 125
112 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF ACE_H_ 126 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF ACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698