| OLD | NEW |
| 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/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 | 9 |
| 10 #include "gpu/command_buffer/common/constants.h" | 10 #include "gpu/command_buffer/common/constants.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 virtual ~MemoryTrackerStub() {} | 44 virtual ~MemoryTrackerStub() {} |
| 45 | 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(MemoryTrackerStub); | 46 DISALLOW_COPY_AND_ASSIGN(MemoryTrackerStub); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 } // anonymous namespace | 49 } // anonymous namespace |
| 50 | 50 |
| 51 CommandBufferImpl::CommandBufferImpl(ScopedCommandBufferClientHandle client, | 51 CommandBufferImpl::CommandBufferImpl(gfx::AcceleratedWidget widget, |
| 52 gfx::AcceleratedWidget widget, | |
| 53 const gfx::Size& size) | 52 const gfx::Size& size) |
| 54 : client_(client.Pass(), this), widget_(widget), size_(size) {} | 53 : widget_(widget), size_(size) {} |
| 55 | 54 |
| 56 CommandBufferImpl::~CommandBufferImpl() { client_->DidDestroy(); } | 55 CommandBufferImpl::~CommandBufferImpl() { |
| 56 // XXX do we have a client_ here? |
| 57 client_->DidDestroy(); |
| 58 } |
| 59 |
| 60 void CommandBufferImpl::SetClient(CommandBufferClient* client) { |
| 61 client_ = client; |
| 62 } |
| 57 | 63 |
| 58 void CommandBufferImpl::Initialize( | 64 void CommandBufferImpl::Initialize( |
| 59 ScopedCommandBufferSyncClientHandle sync_client, | 65 CommandBufferSyncClientPtr sync_client, |
| 60 mojo::ScopedSharedBufferHandle shared_state) { | 66 mojo::ScopedSharedBufferHandle shared_state) { |
| 61 sync_client_.reset(sync_client.Pass(), NULL); | 67 sync_client_ = sync_client.Pass(); |
| 62 sync_client_->DidInitialize(DoInitialize(shared_state.Pass())); | 68 sync_client_->DidInitialize(DoInitialize(shared_state.Pass())); |
| 63 } | 69 } |
| 64 | 70 |
| 65 bool CommandBufferImpl::DoInitialize( | 71 bool CommandBufferImpl::DoInitialize( |
| 66 mojo::ScopedSharedBufferHandle shared_state) { | 72 mojo::ScopedSharedBufferHandle shared_state) { |
| 67 // TODO(piman): offscreen surface. | 73 // TODO(piman): offscreen surface. |
| 68 scoped_refptr<gfx::GLSurface> surface = | 74 scoped_refptr<gfx::GLSurface> surface = |
| 69 gfx::GLSurface::CreateViewGLSurface(widget_); | 75 gfx::GLSurface::CreateViewGLSurface(widget_); |
| 70 if (!surface.get()) | 76 if (!surface.get()) |
| 71 return false; | 77 return false; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 187 |
| 182 void CommandBufferImpl::OnParseError() { | 188 void CommandBufferImpl::OnParseError() { |
| 183 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); | 189 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); |
| 184 client_->LostContext(state.context_lost_reason); | 190 client_->LostContext(state.context_lost_reason); |
| 185 } | 191 } |
| 186 | 192 |
| 187 void CommandBufferImpl::DrawAnimationFrame() { client_->DrawAnimationFrame(); } | 193 void CommandBufferImpl::DrawAnimationFrame() { client_->DrawAnimationFrame(); } |
| 188 | 194 |
| 189 } // namespace services | 195 } // namespace services |
| 190 } // namespace mojo | 196 } // namespace mojo |
| OLD | NEW |