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

Side by Side Diff: mojo/services/gles2/command_buffer_impl.cc

Issue 734273002: Cleanse mojo/services/gles2 of InterfaceImpl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Moar interface request Created 6 years, 1 month 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
« no previous file with comments | « mojo/services/gles2/command_buffer_impl.h ('k') | mojo/services/gles2/gpu_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "mojo/services/gles2/command_buffer_impl.h" 5 #include "mojo/services/gles2/command_buffer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "gpu/command_buffer/common/constants.h" 10 #include "gpu/command_buffer/common/constants.h"
(...skipping 26 matching lines...) Expand all
37 37
38 private: 38 private:
39 ~MemoryTrackerStub() override {} 39 ~MemoryTrackerStub() override {}
40 40
41 DISALLOW_COPY_AND_ASSIGN(MemoryTrackerStub); 41 DISALLOW_COPY_AND_ASSIGN(MemoryTrackerStub);
42 }; 42 };
43 43
44 } // anonymous namespace 44 } // anonymous namespace
45 45
46 CommandBufferImpl::CommandBufferImpl( 46 CommandBufferImpl::CommandBufferImpl(
47 InterfaceRequest<CommandBuffer> request,
47 gfx::GLShareGroup* share_group, 48 gfx::GLShareGroup* share_group,
48 gpu::gles2::MailboxManager* mailbox_manager) 49 gpu::gles2::MailboxManager* mailbox_manager)
49 : widget_(gfx::kNullAcceleratedWidget), 50 : CommandBufferImpl(request.Pass(),
50 size_(1, 1), 51 gfx::kNullAcceleratedWidget,
51 share_group_(share_group), 52 gfx::Size(1, 1),
52 mailbox_manager_(mailbox_manager) { 53 share_group,
54 mailbox_manager) {
53 } 55 }
54 56
55 CommandBufferImpl::CommandBufferImpl( 57 CommandBufferImpl::CommandBufferImpl(
58 InterfaceRequest<CommandBuffer> request,
56 gfx::AcceleratedWidget widget, 59 gfx::AcceleratedWidget widget,
57 const gfx::Size& size, 60 const gfx::Size& size,
58 gfx::GLShareGroup* share_group, 61 gfx::GLShareGroup* share_group,
59 gpu::gles2::MailboxManager* mailbox_manager) 62 gpu::gles2::MailboxManager* mailbox_manager)
60 : widget_(widget), 63 : widget_(widget),
61 size_(size), 64 size_(size),
62 share_group_(share_group), 65 share_group_(share_group),
63 mailbox_manager_(mailbox_manager) { 66 mailbox_manager_(mailbox_manager),
67 binding_(this, request.Pass()) {
64 } 68 }
65 69
66 CommandBufferImpl::~CommandBufferImpl() { 70 CommandBufferImpl::~CommandBufferImpl() {
67 client()->DidDestroy(); 71 binding_.client()->DidDestroy();
68 if (decoder_) { 72 if (decoder_) {
69 bool have_context = decoder_->MakeCurrent(); 73 bool have_context = decoder_->MakeCurrent();
70 decoder_->Destroy(have_context); 74 decoder_->Destroy(have_context);
71 } 75 }
72 } 76 }
73 77
74 void CommandBufferImpl::Initialize( 78 void CommandBufferImpl::Initialize(
75 CommandBufferSyncClientPtr sync_client, 79 CommandBufferSyncClientPtr sync_client,
76 mojo::ScopedSharedBufferHandle shared_state) { 80 mojo::ScopedSharedBufferHandle shared_state) {
77 sync_client_ = sync_client.Pass(); 81 sync_client_ = sync_client.Pass();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return true; 156 return true;
153 } 157 }
154 158
155 void CommandBufferImpl::SetGetBuffer(int32_t buffer) { 159 void CommandBufferImpl::SetGetBuffer(int32_t buffer) {
156 command_buffer_->SetGetBuffer(buffer); 160 command_buffer_->SetGetBuffer(buffer);
157 } 161 }
158 162
159 void CommandBufferImpl::Flush(int32_t put_offset) { 163 void CommandBufferImpl::Flush(int32_t put_offset) {
160 if (!context_->MakeCurrent(surface_.get())) { 164 if (!context_->MakeCurrent(surface_.get())) {
161 DLOG(WARNING) << "Context lost"; 165 DLOG(WARNING) << "Context lost";
162 client()->LostContext(gpu::error::kUnknown); 166 binding_.client()->LostContext(gpu::error::kUnknown);
163 return; 167 return;
164 } 168 }
165 command_buffer_->Flush(put_offset); 169 command_buffer_->Flush(put_offset);
166 } 170 }
167 171
168 void CommandBufferImpl::MakeProgress(int32_t last_get_offset) { 172 void CommandBufferImpl::MakeProgress(int32_t last_get_offset) {
169 // TODO(piman): handle out-of-order. 173 // TODO(piman): handle out-of-order.
170 sync_client_->DidMakeProgress( 174 sync_client_->DidMakeProgress(
171 CommandBufferState::From(command_buffer_->GetLastState())); 175 CommandBufferState::From(command_buffer_->GetLastState()));
172 } 176 }
(...skipping 16 matching lines...) Expand all
189 void CommandBufferImpl::DestroyTransferBuffer(int32_t id) { 193 void CommandBufferImpl::DestroyTransferBuffer(int32_t id) {
190 command_buffer_->DestroyTransferBuffer(id); 194 command_buffer_->DestroyTransferBuffer(id);
191 } 195 }
192 196
193 void CommandBufferImpl::Echo(const Callback<void()>& callback) { 197 void CommandBufferImpl::Echo(const Callback<void()>& callback) {
194 callback.Run(); 198 callback.Run();
195 } 199 }
196 200
197 void CommandBufferImpl::OnParseError() { 201 void CommandBufferImpl::OnParseError() {
198 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); 202 gpu::CommandBuffer::State state = command_buffer_->GetLastState();
199 client()->LostContext(state.context_lost_reason); 203 binding_.client()->LostContext(state.context_lost_reason);
200 } 204 }
201 205
202 void CommandBufferImpl::OnResize(gfx::Size size, float scale_factor) { 206 void CommandBufferImpl::OnResize(gfx::Size size, float scale_factor) {
203 surface_->Resize(size); 207 surface_->Resize(size);
204 } 208 }
205 209
206 } // namespace mojo 210 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/gles2/command_buffer_impl.h ('k') | mojo/services/gles2/gpu_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698