OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_context_3d_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_context_3d_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
9 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 9 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
10 #include "gpu/command_buffer/client/gles2_implementation.h" | 10 #include "gpu/command_buffer/client/gles2_implementation.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 command_buffer->GetTransferBuffer(transfer_buffer_id_); | 326 command_buffer->GetTransferBuffer(transfer_buffer_id_); |
327 if (!transfer_buffer.ptr) | 327 if (!transfer_buffer.ptr) |
328 return false; | 328 return false; |
329 | 329 |
330 // Create the object exposing the OpenGL API. | 330 // Create the object exposing the OpenGL API. |
331 gles2_impl_.reset(new gpu::gles2::GLES2Implementation( | 331 gles2_impl_.reset(new gpu::gles2::GLES2Implementation( |
332 helper_.get(), | 332 helper_.get(), |
333 transfer_buffer.size, | 333 transfer_buffer.size, |
334 transfer_buffer.ptr, | 334 transfer_buffer.ptr, |
335 transfer_buffer_id_, | 335 transfer_buffer_id_, |
336 false, | 336 false)); |
337 true)); | |
338 | 337 |
339 return true; | 338 return true; |
340 } | 339 } |
341 | 340 |
342 void PPB_Context3D_Impl::Destroy() { | 341 void PPB_Context3D_Impl::Destroy() { |
343 if (draw_surface_) | 342 if (draw_surface_) |
344 draw_surface_->BindToContext(NULL); | 343 draw_surface_->BindToContext(NULL); |
345 | 344 |
346 gles2_impl_.reset(); | 345 gles2_impl_.reset(); |
347 | 346 |
348 if (platform_context_.get() && transfer_buffer_id_ != 0) { | 347 if (platform_context_.get() && transfer_buffer_id_ != 0) { |
349 platform_context_->GetCommandBuffer()->DestroyTransferBuffer( | 348 platform_context_->GetCommandBuffer()->DestroyTransferBuffer( |
350 transfer_buffer_id_); | 349 transfer_buffer_id_); |
351 transfer_buffer_id_ = 0; | 350 transfer_buffer_id_ = 0; |
352 } | 351 } |
353 | 352 |
354 helper_.reset(); | 353 helper_.reset(); |
355 platform_context_.reset(); | 354 platform_context_.reset(); |
356 } | 355 } |
357 | 356 |
358 void PPB_Context3D_Impl::OnContextLost() { | 357 void PPB_Context3D_Impl::OnContextLost() { |
359 if (draw_surface_) | 358 if (draw_surface_) |
360 draw_surface_->OnContextLost(); | 359 draw_surface_->OnContextLost(); |
361 if (read_surface_) | 360 if (read_surface_) |
362 read_surface_->OnContextLost(); | 361 read_surface_->OnContextLost(); |
363 } | 362 } |
364 | 363 |
365 } // namespace ppapi | 364 } // namespace ppapi |
366 } // namespace webkit | 365 } // namespace webkit |
OLD | NEW |