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

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

Issue 265793015: Mojo: Replace RemotePtr with InterfacePtr and InterfaceImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 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/public/cpp/bindings/remote_ptr.h"
17 #include "mojo/services/gles2/command_buffer.mojom.h" 16 #include "mojo/services/gles2/command_buffer.mojom.h"
18 17
19 namespace base { 18 namespace base {
20 class RunLoop; 19 class RunLoop;
21 } 20 }
22 21
23 namespace mojo { 22 namespace mojo {
24 template <typename S> 23 template <typename S>
25 class SyncDispatcher; 24 class SyncDispatcher;
26 25
27 namespace gles2 { 26 namespace gles2 {
28 class CommandBufferClientImpl; 27 class CommandBufferClientImpl;
29 28
30 class CommandBufferDelegate { 29 class CommandBufferDelegate {
31 public: 30 public:
32 virtual ~CommandBufferDelegate(); 31 virtual ~CommandBufferDelegate();
33 virtual void ContextLost(); 32 virtual void ContextLost();
34 virtual void DrawAnimationFrame(); 33 virtual void DrawAnimationFrame();
35 }; 34 };
36 35
37 class CommandBufferClientImpl : public CommandBufferClient, 36 class CommandBufferClientImpl : public CommandBufferClient,
38 public CommandBufferSyncClient, 37 public CommandBufferSyncClient,
39 public ErrorHandler, 38 public ErrorHandler,
40 public gpu::CommandBuffer, 39 public gpu::CommandBuffer,
41 public gpu::GpuControl { 40 public gpu::GpuControl {
42 public: 41 public:
43 explicit CommandBufferClientImpl( 42 explicit CommandBufferClientImpl(
44 CommandBufferDelegate* delegate, 43 CommandBufferDelegate* delegate,
45 MojoAsyncWaiter* async_waiter, 44 MojoAsyncWaiter* async_waiter,
46 ScopedCommandBufferHandle command_buffer_handle); 45 ScopedMessagePipeHandle command_buffer_handle);
47 virtual ~CommandBufferClientImpl(); 46 virtual ~CommandBufferClientImpl();
48 47
49 // CommandBuffer implementation: 48 // CommandBuffer implementation:
50 virtual bool Initialize() OVERRIDE; 49 virtual bool Initialize() OVERRIDE;
51 virtual State GetLastState() OVERRIDE; 50 virtual State GetLastState() OVERRIDE;
52 virtual int32 GetLastToken() OVERRIDE; 51 virtual int32 GetLastToken() OVERRIDE;
53 virtual void Flush(int32 put_offset) OVERRIDE; 52 virtual void Flush(int32 put_offset) OVERRIDE;
54 virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE; 53 virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE;
55 virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE; 54 virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE;
56 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; 55 virtual void SetGetBuffer(int32 shm_id) OVERRIDE;
(...skipping 24 matching lines...) Expand all
81 void CancelAnimationFrames(); 80 void CancelAnimationFrames();
82 81
83 private: 82 private:
84 // CommandBufferClient implementation: 83 // CommandBufferClient implementation:
85 virtual void DidInitialize(bool success) OVERRIDE; 84 virtual void DidInitialize(bool success) OVERRIDE;
86 virtual void DidMakeProgress(const CommandBufferState& state) OVERRIDE; 85 virtual void DidMakeProgress(const CommandBufferState& state) OVERRIDE;
87 virtual void DidDestroy() OVERRIDE; 86 virtual void DidDestroy() OVERRIDE;
88 virtual void LostContext(int32_t lost_reason) OVERRIDE; 87 virtual void LostContext(int32_t lost_reason) OVERRIDE;
89 88
90 // ErrorHandler implementation: 89 // ErrorHandler implementation:
91 virtual void OnError() OVERRIDE; 90 virtual void OnConnectionError() OVERRIDE;
92 91
93 virtual void DrawAnimationFrame() OVERRIDE; 92 virtual void DrawAnimationFrame() OVERRIDE;
94 93
95 void TryUpdateState(); 94 void TryUpdateState();
96 void MakeProgressAndUpdateState(); 95 void MakeProgressAndUpdateState();
97 96
98 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } 97 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; }
99 98
100 CommandBufferDelegate* delegate_; 99 CommandBufferDelegate* delegate_;
101 RemotePtr<mojo::CommandBuffer> command_buffer_; 100 CommandBufferPtr command_buffer_;
102 scoped_ptr<SyncDispatcher<CommandBufferSyncClient> > sync_dispatcher_; 101 scoped_ptr<SyncDispatcher<CommandBufferSyncClient> > sync_dispatcher_;
103 102
104 State last_state_; 103 State last_state_;
105 mojo::ScopedSharedBufferHandle shared_state_handle_; 104 mojo::ScopedSharedBufferHandle shared_state_handle_;
106 gpu::CommandBufferSharedState* shared_state_; 105 gpu::CommandBufferSharedState* shared_state_;
107 int32 last_put_offset_; 106 int32 last_put_offset_;
108 int32 next_transfer_buffer_id_; 107 int32 next_transfer_buffer_id_;
109 108
110 bool initialize_result_; 109 bool initialize_result_;
111 }; 110 };
112 111
113 } // gles2 112 } // gles2
114 } // mojo 113 } // mojo
115 114
116 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ 115 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698