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

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

Issue 10386145: Add the necessary plumbing mechanisms to ensure proper WebGL support inside the <browser> tag, whic… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Shuffle EnterResource back out of the thunk layer Created 8 years, 6 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
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/transfer_buffer.h" 10 #include "gpu/command_buffer/client/transfer_buffer.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 void PPB_Graphics3D_Shared::SwapBuffersACK(int32_t pp_error) { 91 void PPB_Graphics3D_Shared::SwapBuffersACK(int32_t pp_error) {
92 DCHECK(HasPendingSwap()); 92 DCHECK(HasPendingSwap());
93 TrackedCallback::ClearAndRun(&swap_callback_, pp_error); 93 TrackedCallback::ClearAndRun(&swap_callback_, pp_error);
94 } 94 }
95 95
96 bool PPB_Graphics3D_Shared::HasPendingSwap() const { 96 bool PPB_Graphics3D_Shared::HasPendingSwap() const {
97 return TrackedCallback::IsPending(swap_callback_); 97 return TrackedCallback::IsPending(swap_callback_);
98 } 98 }
99 99
100 bool PPB_Graphics3D_Shared::CreateGLES2Impl(int32 command_buffer_size, 100 bool PPB_Graphics3D_Shared::CreateGLES2Impl(
101 int32 transfer_buffer_size) { 101 int32 command_buffer_size,
102 int32 transfer_buffer_size,
103 gpu::gles2::GLES2Implementation* share_gles2) {
102 gpu::CommandBuffer* command_buffer = GetCommandBuffer(); 104 gpu::CommandBuffer* command_buffer = GetCommandBuffer();
103 DCHECK(command_buffer); 105 DCHECK(command_buffer);
104 106
105 // Create the GLES2 helper, which writes the command buffer protocol. 107 // Create the GLES2 helper, which writes the command buffer protocol.
106 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer)); 108 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer));
107 if (!gles2_helper_->Initialize(command_buffer_size)) 109 if (!gles2_helper_->Initialize(command_buffer_size))
108 return false; 110 return false;
109 111
110 // Create a transfer buffer used to copy resources between the renderer 112 // Create a transfer buffer used to copy resources between the renderer
111 // process and the GPU process. 113 // process and the GPU process.
112 const int32 kMinTransferBufferSize = 256 * 1024; 114 const int32 kMinTransferBufferSize = 256 * 1024;
113 const int32 kMaxTransferBufferSize = 16 * 1024 * 1024; 115 const int32 kMaxTransferBufferSize = 16 * 1024 * 1024;
114 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); 116 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get()));
115 117
116 // Create the object exposing the OpenGL API. 118 // Create the object exposing the OpenGL API.
117 gles2_impl_.reset(new gpu::gles2::GLES2Implementation( 119 gles2_impl_.reset(new gpu::gles2::GLES2Implementation(
118 gles2_helper_.get(), 120 gles2_helper_.get(),
119 NULL, 121 share_gles2 ? share_gles2->share_group() : NULL,
120 transfer_buffer_.get(), 122 transfer_buffer_.get(),
121 false, 123 false,
122 true)); 124 true));
123 125
124 if (!gles2_impl_->Initialize( 126 if (!gles2_impl_->Initialize(
125 transfer_buffer_size, 127 transfer_buffer_size,
126 kMinTransferBufferSize, 128 kMinTransferBufferSize,
127 std::max(kMaxTransferBufferSize, transfer_buffer_size))) { 129 std::max(kMaxTransferBufferSize, transfer_buffer_size))) {
128 return false; 130 return false;
129 } 131 }
130 132
131 return true; 133 return true;
132 } 134 }
133 135
134 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { 136 void PPB_Graphics3D_Shared::DestroyGLES2Impl() {
135 gles2_impl_.reset(); 137 gles2_impl_.reset();
136 transfer_buffer_.reset(); 138 transfer_buffer_.reset();
137 gles2_helper_.reset(); 139 gles2_helper_.reset();
138 } 140 }
139 141
140 } // namespace ppapi 142 } // namespace ppapi
141 143
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698