| 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" |
| 11 #include "gpu/command_buffer/common/sync_token.h" |
| 11 #include "ppapi/c/pp_errors.h" | 12 #include "ppapi/c/pp_errors.h" |
| 12 | 13 |
| 13 namespace ppapi { | 14 namespace ppapi { |
| 14 | 15 |
| 15 PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(PP_Instance instance) | 16 PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(PP_Instance instance) |
| 16 : Resource(OBJECT_IS_IMPL, instance) {} | 17 : Resource(OBJECT_IS_IMPL, instance) {} |
| 17 | 18 |
| 18 PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(const HostResource& host_resource) | 19 PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(const HostResource& host_resource) |
| 19 : Resource(OBJECT_IS_PROXY, host_resource) {} | 20 : Resource(OBJECT_IS_PROXY, host_resource) {} |
| 20 | 21 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 47 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { | 48 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { |
| 48 if ((width < 0) || (height < 0)) | 49 if ((width < 0) || (height < 0)) |
| 49 return PP_ERROR_BADARGUMENT; | 50 return PP_ERROR_BADARGUMENT; |
| 50 | 51 |
| 51 gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true); | 52 gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true); |
| 52 // TODO(alokp): Check if resize succeeded and return appropriate error code. | 53 // TODO(alokp): Check if resize succeeded and return appropriate error code. |
| 53 return PP_OK; | 54 return PP_OK; |
| 54 } | 55 } |
| 55 | 56 |
| 56 int32_t PPB_Graphics3D_Shared::SwapBuffers( | 57 int32_t PPB_Graphics3D_Shared::SwapBuffers( |
| 58 scoped_refptr<TrackedCallback> callback) { |
| 59 return SwapBuffersWithSyncToken(callback, gpu::SyncToken()); |
| 60 } |
| 61 |
| 62 int32_t PPB_Graphics3D_Shared::SwapBuffersWithSyncToken( |
| 57 scoped_refptr<TrackedCallback> callback, | 63 scoped_refptr<TrackedCallback> callback, |
| 58 const gpu::SyncToken& sync_token) { | 64 const gpu::SyncToken& sync_token) { |
| 59 if (HasPendingSwap()) { | 65 if (HasPendingSwap()) { |
| 60 Log(PP_LOGLEVEL_ERROR, | 66 Log(PP_LOGLEVEL_ERROR, |
| 61 "PPB_Graphics3D.SwapBuffers: Plugin attempted swap " | 67 "PPB_Graphics3D.SwapBuffers: Plugin attempted swap " |
| 62 "with previous swap still pending."); | 68 "with previous swap still pending."); |
| 63 // Already a pending SwapBuffers that hasn't returned yet. | 69 // Already a pending SwapBuffers that hasn't returned yet. |
| 64 return PP_ERROR_INPROGRESS; | 70 return PP_ERROR_INPROGRESS; |
| 65 } | 71 } |
| 66 | 72 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return true; | 155 return true; |
| 150 } | 156 } |
| 151 | 157 |
| 152 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { | 158 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { |
| 153 gles2_impl_.reset(); | 159 gles2_impl_.reset(); |
| 154 transfer_buffer_.reset(); | 160 transfer_buffer_.reset(); |
| 155 gles2_helper_.reset(); | 161 gles2_helper_.reset(); |
| 156 } | 162 } |
| 157 | 163 |
| 158 } // namespace ppapi | 164 } // namespace ppapi |
| OLD | NEW |