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

Side by Side Diff: mojo/gles2/command_buffer_client_impl.h

Issue 384513003: Remove RequestAnimationFrame from mojo, add delayed tasks to RunLoop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ 5 #ifndef MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_
6 #define MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ 6 #define MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "gpu/command_buffer/client/gpu_control.h" 12 #include "gpu/command_buffer/client/gpu_control.h"
13 #include "gpu/command_buffer/common/command_buffer.h" 13 #include "gpu/command_buffer/common/command_buffer.h"
14 #include "gpu/command_buffer/common/command_buffer_shared.h" 14 #include "gpu/command_buffer/common/command_buffer_shared.h"
15 #include "mojo/public/cpp/bindings/error_handler.h" 15 #include "mojo/public/cpp/bindings/error_handler.h"
16 #include "mojo/services/gles2/command_buffer.mojom.h" 16 #include "mojo/services/gles2/command_buffer.mojom.h"
17 17
18 namespace base { 18 namespace base {
19 class RunLoop; 19 class RunLoop;
20 } 20 }
21 21
22 namespace mojo { 22 namespace mojo {
23 namespace gles2 { 23 namespace gles2 {
24 class CommandBufferClientImpl; 24 class CommandBufferClientImpl;
25 25
26 class CommandBufferDelegate { 26 class CommandBufferDelegate {
27 public: 27 public:
28 virtual ~CommandBufferDelegate(); 28 virtual ~CommandBufferDelegate();
29 virtual void ContextLost(); 29 virtual void ContextLost();
30 virtual void DrawAnimationFrame();
31 }; 30 };
32 31
33 class CommandBufferClientImpl : public CommandBufferClient, 32 class CommandBufferClientImpl : public CommandBufferClient,
34 public ErrorHandler, 33 public ErrorHandler,
35 public gpu::CommandBuffer, 34 public gpu::CommandBuffer,
36 public gpu::GpuControl { 35 public gpu::GpuControl {
37 public: 36 public:
38 explicit CommandBufferClientImpl( 37 explicit CommandBufferClientImpl(
39 CommandBufferDelegate* delegate, 38 CommandBufferDelegate* delegate,
40 const MojoAsyncWaiter* async_waiter, 39 const MojoAsyncWaiter* async_waiter,
(...skipping 24 matching lines...) Expand all
65 virtual uint32 InsertFutureSyncPoint() OVERRIDE; 64 virtual uint32 InsertFutureSyncPoint() OVERRIDE;
66 virtual void RetireSyncPoint(uint32 sync_point) OVERRIDE; 65 virtual void RetireSyncPoint(uint32 sync_point) OVERRIDE;
67 virtual void SignalSyncPoint(uint32 sync_point, 66 virtual void SignalSyncPoint(uint32 sync_point,
68 const base::Closure& callback) OVERRIDE; 67 const base::Closure& callback) OVERRIDE;
69 virtual void SignalQuery(uint32 query, 68 virtual void SignalQuery(uint32 query,
70 const base::Closure& callback) OVERRIDE; 69 const base::Closure& callback) OVERRIDE;
71 virtual void SetSurfaceVisible(bool visible) OVERRIDE; 70 virtual void SetSurfaceVisible(bool visible) OVERRIDE;
72 virtual void Echo(const base::Closure& callback) OVERRIDE; 71 virtual void Echo(const base::Closure& callback) OVERRIDE;
73 virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE; 72 virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE;
74 73
75 void RequestAnimationFrames();
76 void CancelAnimationFrames();
77
78 private: 74 private:
79 class SyncClientImpl; 75 class SyncClientImpl;
80 76
81 // CommandBufferClient implementation: 77 // CommandBufferClient implementation:
82 virtual void DidDestroy() OVERRIDE; 78 virtual void DidDestroy() OVERRIDE;
83 virtual void LostContext(int32_t lost_reason) OVERRIDE; 79 virtual void LostContext(int32_t lost_reason) OVERRIDE;
84 virtual void DrawAnimationFrame() OVERRIDE;
85 80
86 // ErrorHandler implementation: 81 // ErrorHandler implementation:
87 virtual void OnConnectionError() OVERRIDE; 82 virtual void OnConnectionError() OVERRIDE;
88 83
89 void TryUpdateState(); 84 void TryUpdateState();
90 void MakeProgressAndUpdateState(); 85 void MakeProgressAndUpdateState();
91 86
92 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } 87 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; }
93 88
94 CommandBufferDelegate* delegate_; 89 CommandBufferDelegate* delegate_;
95 CommandBufferPtr command_buffer_; 90 CommandBufferPtr command_buffer_;
96 scoped_ptr<SyncClientImpl> sync_client_impl_; 91 scoped_ptr<SyncClientImpl> sync_client_impl_;
97 92
98 State last_state_; 93 State last_state_;
99 mojo::ScopedSharedBufferHandle shared_state_handle_; 94 mojo::ScopedSharedBufferHandle shared_state_handle_;
100 gpu::CommandBufferSharedState* shared_state_; 95 gpu::CommandBufferSharedState* shared_state_;
101 int32 last_put_offset_; 96 int32 last_put_offset_;
102 int32 next_transfer_buffer_id_; 97 int32 next_transfer_buffer_id_;
103 98
104 const MojoAsyncWaiter* async_waiter_; 99 const MojoAsyncWaiter* async_waiter_;
105 }; 100 };
106 101
107 } // gles2 102 } // gles2
108 } // mojo 103 } // mojo
109 104
110 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ 105 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698