| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 5 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| 9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 10 #include "gpu/command_buffer/client/transfer_buffer.h" | 10 #include "gpu/command_buffer/client/transfer_buffer.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { | 49 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { |
| 50 if ((width < 0) || (height < 0)) | 50 if ((width < 0) || (height < 0)) |
| 51 return PP_ERROR_BADARGUMENT; | 51 return PP_ERROR_BADARGUMENT; |
| 52 | 52 |
| 53 gles2_impl()->ResizeCHROMIUM(width, height); | 53 gles2_impl()->ResizeCHROMIUM(width, height); |
| 54 // TODO(alokp): Check if resize succeeded and return appropriate error code. | 54 // TODO(alokp): Check if resize succeeded and return appropriate error code. |
| 55 return PP_OK; | 55 return PP_OK; |
| 56 } | 56 } |
| 57 | 57 |
| 58 int32_t PPB_Graphics3D_Shared::SwapBuffers(PP_CompletionCallback callback) { | 58 int32_t PPB_Graphics3D_Shared::SwapBuffers(ApiCallbackType callback) { |
| 59 if (!callback.func) { | |
| 60 // Blocking SwapBuffers isn't supported (since we have to be on the main | |
| 61 // thread). | |
| 62 return PP_ERROR_BADARGUMENT; | |
| 63 } | |
| 64 | |
| 65 if (HasPendingSwap()) { | 59 if (HasPendingSwap()) { |
| 66 // Already a pending SwapBuffers that hasn't returned yet. | 60 // Already a pending SwapBuffers that hasn't returned yet. |
| 67 return PP_ERROR_INPROGRESS; | 61 return PP_ERROR_INPROGRESS; |
| 68 } | 62 } |
| 69 | 63 |
| 70 swap_callback_ = new TrackedCallback(this, callback); | 64 swap_callback_ = callback; |
| 71 return DoSwapBuffers(); | 65 return DoSwapBuffers(); |
| 72 } | 66 } |
| 73 | 67 |
| 74 void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target, | 68 void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target, |
| 75 GLint level, | 69 GLint level, |
| 76 GLint xoffset, | 70 GLint xoffset, |
| 77 GLint yoffset, | 71 GLint yoffset, |
| 78 GLsizei width, | 72 GLsizei width, |
| 79 GLsizei height, | 73 GLsizei height, |
| 80 GLenum format, | 74 GLenum format, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 126 } |
| 133 | 127 |
| 134 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { | 128 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { |
| 135 gles2_impl_.reset(); | 129 gles2_impl_.reset(); |
| 136 transfer_buffer_.reset(); | 130 transfer_buffer_.reset(); |
| 137 gles2_helper_.reset(); | 131 gles2_helper_.reset(); |
| 138 } | 132 } |
| 139 | 133 |
| 140 } // namespace ppapi | 134 } // namespace ppapi |
| 141 | 135 |
| OLD | NEW |