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

Side by Side Diff: content/renderer/pepper/ppb_graphics_3d_impl.cc

Issue 2135063002: Revert of Simplify ppapi Graphics3D size propagation a bit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_attr_parse_to_pepper
Patch Set: 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 | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | ppapi/ppapi_internal.gyp » ('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 "content/renderer/pepper/ppb_graphics_3d_impl.h" 5 #include "content/renderer/pepper/ppb_graphics_3d_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 gpu::CommandBuffer* PPB_Graphics3D_Impl::GetCommandBuffer() { 162 gpu::CommandBuffer* PPB_Graphics3D_Impl::GetCommandBuffer() {
163 return command_buffer_.get(); 163 return command_buffer_.get();
164 } 164 }
165 165
166 gpu::GpuControl* PPB_Graphics3D_Impl::GetGpuControl() { 166 gpu::GpuControl* PPB_Graphics3D_Impl::GetGpuControl() {
167 return command_buffer_.get(); 167 return command_buffer_.get();
168 } 168 }
169 169
170 int32_t PPB_Graphics3D_Impl::DoSwapBuffers(const gpu::SyncToken& sync_token, 170 int32_t PPB_Graphics3D_Impl::DoSwapBuffers(const gpu::SyncToken& sync_token,
171 const gfx::Size& size) { 171 int32_t width,
172 int32_t height) {
172 DCHECK(command_buffer_); 173 DCHECK(command_buffer_);
173 if (taken_front_buffer_.IsZero()) { 174 if (taken_front_buffer_.IsZero()) {
174 DLOG(ERROR) << "TakeFrontBuffer should be called before DoSwapBuffers"; 175 DLOG(ERROR) << "TakeFrontBuffer should be called before DoSwapBuffers";
175 return PP_ERROR_FAILED; 176 return PP_ERROR_FAILED;
176 } 177 }
177 178
178 if (bound_to_instance_) { 179 if (bound_to_instance_) {
179 // If we are bound to the instance, we need to ask the compositor 180 // If we are bound to the instance, we need to ask the compositor
180 // to commit our backing texture so that the graphics appears on the page. 181 // to commit our backing texture so that the graphics appears on the page.
181 // When the backing texture will be committed we get notified via 182 // When the backing texture will be committed we get notified via
182 // ViewFlushedPaint(). 183 // ViewFlushedPaint().
183 // 184 //
184 // Don't need to check for NULL from GetPluginInstance since when we're 185 // Don't need to check for NULL from GetPluginInstance since when we're
185 // bound, we know our instance is valid. 186 // bound, we know our instance is valid.
187 if (width < 0 || height < 0) {
188 width = original_width_;
189 height = original_height_;
190 }
186 bool is_overlay_candidate = use_image_chromium_; 191 bool is_overlay_candidate = use_image_chromium_;
187 GLenum target = 192 GLenum target =
188 is_overlay_candidate ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D; 193 is_overlay_candidate ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D;
189 cc::TextureMailbox texture_mailbox(taken_front_buffer_, sync_token, target, 194 cc::TextureMailbox texture_mailbox(taken_front_buffer_, sync_token, target,
190 size, is_overlay_candidate, false); 195 gfx::Size(width, height),
196 is_overlay_candidate, false);
191 taken_front_buffer_.SetZero(); 197 taken_front_buffer_.SetZero();
192 HostGlobals::Get() 198 HostGlobals::Get()
193 ->GetInstance(pp_instance()) 199 ->GetInstance(pp_instance())
194 ->CommitTextureMailbox(texture_mailbox); 200 ->CommitTextureMailbox(texture_mailbox);
195 commit_pending_ = true; 201 commit_pending_ = true;
196 } else { 202 } else {
197 // Wait for the command to complete on the GPU to allow for throttling. 203 // Wait for the command to complete on the GPU to allow for throttling.
198 command_buffer_->SignalSyncToken( 204 command_buffer_->SignalSyncToken(
199 sync_token, base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers, 205 sync_token, base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers,
200 weak_ptr_factory_.GetWeakPtr())); 206 weak_ptr_factory_.GetWeakPtr()));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (share_context) { 254 if (share_context) {
249 PPB_Graphics3D_Impl* share_graphics = 255 PPB_Graphics3D_Impl* share_graphics =
250 static_cast<PPB_Graphics3D_Impl*>(share_context); 256 static_cast<PPB_Graphics3D_Impl*>(share_context);
251 share_buffer = share_graphics->GetCommandBufferProxy(); 257 share_buffer = share_graphics->GetCommandBufferProxy();
252 } 258 }
253 259
254 command_buffer_ = gpu::CommandBufferProxyImpl::Create( 260 command_buffer_ = gpu::CommandBufferProxyImpl::Create(
255 std::move(channel), gpu::kNullSurfaceHandle, share_buffer, 261 std::move(channel), gpu::kNullSurfaceHandle, share_buffer,
256 gpu::GPU_STREAM_DEFAULT, gpu::GpuStreamPriority::NORMAL, attrib_helper, 262 gpu::GPU_STREAM_DEFAULT, gpu::GpuStreamPriority::NORMAL, attrib_helper,
257 GURL::EmptyGURL(), base::ThreadTaskRunnerHandle::Get()); 263 GURL::EmptyGURL(), base::ThreadTaskRunnerHandle::Get());
264 original_width_ = attrib_helper.offscreen_framebuffer_size.width();
265 original_height_ = attrib_helper.offscreen_framebuffer_size.height();
258 if (!command_buffer_) 266 if (!command_buffer_)
259 return false; 267 return false;
260 268
261 command_buffer_->SetGpuControlClient(this); 269 command_buffer_->SetGpuControlClient(this);
262 270
263 if (shared_state_handle) 271 if (shared_state_handle)
264 *shared_state_handle = command_buffer_->GetSharedStateHandle(); 272 *shared_state_handle = command_buffer_->GetSharedStateHandle();
265 if (capabilities) 273 if (capabilities)
266 *capabilities = command_buffer_->GetCapabilities(); 274 *capabilities = command_buffer_->GetCapabilities();
267 if (command_buffer_id) 275 if (command_buffer_id)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (!mailboxes_to_reuse_.empty()) { 356 if (!mailboxes_to_reuse_.empty()) {
349 gpu::Mailbox mailbox = mailboxes_to_reuse_.back(); 357 gpu::Mailbox mailbox = mailboxes_to_reuse_.back();
350 mailboxes_to_reuse_.pop_back(); 358 mailboxes_to_reuse_.pop_back();
351 return mailbox; 359 return mailbox;
352 } 360 }
353 361
354 return gpu::Mailbox::Generate(); 362 return gpu::Mailbox::Generate();
355 } 363 }
356 364
357 } // namespace content 365 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | ppapi/ppapi_internal.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698