| OLD | NEW |
| 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 #include "mojo/gles2/gles2_context.h" | 5 #include "mojo/gles2/gles2_context.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 7 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| 8 #include "gpu/command_buffer/client/gles2_implementation.h" | 8 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 9 #include "gpu/command_buffer/client/transfer_buffer.h" | 9 #include "gpu/command_buffer/client/transfer_buffer.h" |
| 10 | 10 |
| 11 namespace gles2 { | 11 namespace gles2 { |
| 12 namespace { |
| 12 | 13 |
| 13 namespace { | |
| 14 const size_t kDefaultCommandBufferSize = 1024 * 1024; | 14 const size_t kDefaultCommandBufferSize = 1024 * 1024; |
| 15 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024; | 15 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024; |
| 16 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024; | 16 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024; |
| 17 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024; | 17 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024; |
| 18 } | 18 |
| 19 } // namespace |
| 19 | 20 |
| 20 GLES2Context::GLES2Context(const MojoAsyncWaiter* async_waiter, | 21 GLES2Context::GLES2Context(const MojoAsyncWaiter* async_waiter, |
| 21 mojo::ScopedMessagePipeHandle command_buffer_handle, | 22 mojo::ScopedMessagePipeHandle command_buffer_handle, |
| 22 MGLContextLostCallback lost_callback, | 23 MGLContextLostCallback lost_callback, |
| 23 void* closure) | 24 void* closure) |
| 24 : command_buffer_(this, async_waiter, command_buffer_handle.Pass()), | 25 : command_buffer_(this, async_waiter, command_buffer_handle.Pass()), |
| 25 lost_callback_(lost_callback), | 26 lost_callback_(lost_callback), |
| 26 closure_(closure) { | 27 closure_(closure) { |
| 27 } | 28 } |
| 28 | 29 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 50 bind_generates_resource, | 51 bind_generates_resource, |
| 51 lose_context_when_out_of_memory, | 52 lose_context_when_out_of_memory, |
| 52 support_client_side_arrays, | 53 support_client_side_arrays, |
| 53 &command_buffer_)); | 54 &command_buffer_)); |
| 54 return implementation_->Initialize(kDefaultStartTransferBufferSize, | 55 return implementation_->Initialize(kDefaultStartTransferBufferSize, |
| 55 kDefaultMinTransferBufferSize, | 56 kDefaultMinTransferBufferSize, |
| 56 kDefaultMaxTransferBufferSize, | 57 kDefaultMaxTransferBufferSize, |
| 57 gpu::gles2::GLES2Implementation::kNoLimit); | 58 gpu::gles2::GLES2Implementation::kNoLimit); |
| 58 } | 59 } |
| 59 | 60 |
| 60 namespace { | 61 void GLES2Context::Echo(MGLEchoCallback callback, void* closure) { |
| 61 void RunSignalSyncCallback(MGLSignalSyncPointCallback callback, | 62 implementation_->Echo(base::Bind(callback, closure)); |
| 62 void* closure) { | |
| 63 callback(closure); | |
| 64 } | |
| 65 } | 63 } |
| 66 | 64 |
| 67 void GLES2Context::SignalSyncPoint(uint32_t sync_point, | 65 void GLES2Context::SignalSyncPoint(uint32_t sync_point, |
| 68 MGLSignalSyncPointCallback callback, | 66 MGLSignalSyncPointCallback callback, |
| 69 void* closure) { | 67 void* closure) { |
| 70 implementation_->SignalSyncPoint( | 68 implementation_->SignalSyncPoint(sync_point, base::Bind(callback, closure)); |
| 71 sync_point, base::Bind(&RunSignalSyncCallback, callback, closure)); | |
| 72 } | 69 } |
| 73 | 70 |
| 74 void GLES2Context::ContextLost() { lost_callback_(closure_); } | 71 void GLES2Context::ContextLost() { lost_callback_(closure_); } |
| 75 | 72 |
| 76 } // namespace gles2 | 73 } // namespace gles2 |
| OLD | NEW |