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

Side by Side Diff: ppapi/shared_impl/ppb_graphics_3d_shared.cc

Issue 2136743002: Simplify ppapi Graphics3D size propagation a bit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_attr_parse_to_pepper
Patch Set: fix win64+gyp build Created 4 years, 5 months 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 | « ppapi/shared_impl/ppb_graphics_3d_shared.h ('k') | ppapi/thunk/ppb_graphics_3d_api.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 (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/shared_memory_limits.h" 10 #include "gpu/command_buffer/client/shared_memory_limits.h"
11 #include "gpu/command_buffer/client/transfer_buffer.h" 11 #include "gpu/command_buffer/client/transfer_buffer.h"
12 #include "gpu/command_buffer/common/sync_token.h" 12 #include "gpu/command_buffer/common/sync_token.h"
13 #include "ppapi/c/pp_errors.h" 13 #include "ppapi/c/pp_errors.h"
14 14
15 namespace ppapi { 15 namespace ppapi {
16 16
17 PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(PP_Instance instance) 17 PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(PP_Instance instance)
18 : Resource(OBJECT_IS_IMPL, instance) {} 18 : Resource(OBJECT_IS_IMPL, instance) {}
19 19
20 PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(const HostResource& host_resource) 20 PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(const HostResource& host_resource,
21 : Resource(OBJECT_IS_PROXY, host_resource) {} 21 const gfx::Size& size)
22 : Resource(OBJECT_IS_PROXY, host_resource), size_(size) {}
22 23
23 PPB_Graphics3D_Shared::~PPB_Graphics3D_Shared() { 24 PPB_Graphics3D_Shared::~PPB_Graphics3D_Shared() {
24 // Make sure that GLES2 implementation has already been destroyed. 25 // Make sure that GLES2 implementation has already been destroyed.
25 DCHECK(!gles2_helper_.get()); 26 DCHECK(!gles2_helper_.get());
26 DCHECK(!transfer_buffer_.get()); 27 DCHECK(!transfer_buffer_.get());
27 DCHECK(!gles2_impl_.get()); 28 DCHECK(!gles2_impl_.get());
28 } 29 }
29 30
30 thunk::PPB_Graphics3D_API* PPB_Graphics3D_Shared::AsPPB_Graphics3D_API() { 31 thunk::PPB_Graphics3D_API* PPB_Graphics3D_Shared::AsPPB_Graphics3D_API() {
31 return this; 32 return this;
(...skipping 12 matching lines...) Expand all
44 int32_t PPB_Graphics3D_Shared::GetError() { 45 int32_t PPB_Graphics3D_Shared::GetError() {
45 // TODO(alokp): Implement me. 46 // TODO(alokp): Implement me.
46 return PP_ERROR_FAILED; 47 return PP_ERROR_FAILED;
47 } 48 }
48 49
49 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { 50 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) {
50 if ((width < 0) || (height < 0)) 51 if ((width < 0) || (height < 0))
51 return PP_ERROR_BADARGUMENT; 52 return PP_ERROR_BADARGUMENT;
52 53
53 gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true); 54 gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true);
54 width_ = width; 55 size_ = gfx::Size(width, height);
55 height_ = height;
56 // TODO(alokp): Check if resize succeeded and return appropriate error code. 56 // TODO(alokp): Check if resize succeeded and return appropriate error code.
57 return PP_OK; 57 return PP_OK;
58 } 58 }
59 59
60 int32_t PPB_Graphics3D_Shared::SwapBuffers( 60 int32_t PPB_Graphics3D_Shared::SwapBuffers(
61 scoped_refptr<TrackedCallback> callback) { 61 scoped_refptr<TrackedCallback> callback) {
62 return SwapBuffersWithSyncToken(callback, gpu::SyncToken(), width_, height_); 62 return SwapBuffersWithSyncToken(callback, gpu::SyncToken(), size_);
63 } 63 }
64 64
65 int32_t PPB_Graphics3D_Shared::SwapBuffersWithSyncToken( 65 int32_t PPB_Graphics3D_Shared::SwapBuffersWithSyncToken(
66 scoped_refptr<TrackedCallback> callback, 66 scoped_refptr<TrackedCallback> callback,
67 const gpu::SyncToken& sync_token, 67 const gpu::SyncToken& sync_token,
68 int32_t width, 68 const gfx::Size& size) {
69 int32_t height) {
70 if (HasPendingSwap()) { 69 if (HasPendingSwap()) {
71 Log(PP_LOGLEVEL_ERROR, 70 Log(PP_LOGLEVEL_ERROR,
72 "PPB_Graphics3D.SwapBuffers: Plugin attempted swap " 71 "PPB_Graphics3D.SwapBuffers: Plugin attempted swap "
73 "with previous swap still pending."); 72 "with previous swap still pending.");
74 // Already a pending SwapBuffers that hasn't returned yet. 73 // Already a pending SwapBuffers that hasn't returned yet.
75 return PP_ERROR_INPROGRESS; 74 return PP_ERROR_INPROGRESS;
76 } 75 }
77 76
78 swap_callback_ = callback; 77 swap_callback_ = callback;
79 return DoSwapBuffers(sync_token, width, height); 78 return DoSwapBuffers(sync_token, size);
80 } 79 }
81 80
82 int32_t PPB_Graphics3D_Shared::GetAttribMaxValue(int32_t attribute, 81 int32_t PPB_Graphics3D_Shared::GetAttribMaxValue(int32_t attribute,
83 int32_t* value) { 82 int32_t* value) {
84 // TODO(alokp): Implement me. 83 // TODO(alokp): Implement me.
85 return PP_ERROR_FAILED; 84 return PP_ERROR_FAILED;
86 } 85 }
87 86
88 void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target, 87 void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target,
89 GLint level, 88 GLint level,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return true; 158 return true;
160 } 159 }
161 160
162 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { 161 void PPB_Graphics3D_Shared::DestroyGLES2Impl() {
163 gles2_impl_.reset(); 162 gles2_impl_.reset();
164 transfer_buffer_.reset(); 163 transfer_buffer_.reset();
165 gles2_helper_.reset(); 164 gles2_helper_.reset();
166 } 165 }
167 166
168 } // namespace ppapi 167 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_graphics_3d_shared.h ('k') | ppapi/thunk/ppb_graphics_3d_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698