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)); |
337 | 338 |
338 return true; | 339 return true; |
339 } | 340 } |
340 | 341 |
341 void PPB_Context3D_Impl::Destroy() { | 342 void PPB_Context3D_Impl::Destroy() { |
342 if (draw_surface_) | 343 if (draw_surface_) |
343 draw_surface_->BindToContext(NULL); | 344 draw_surface_->BindToContext(NULL); |
344 | 345 |
345 gles2_impl_.reset(); | 346 gles2_impl_.reset(); |
346 | 347 |
347 if (platform_context_.get() && transfer_buffer_id_ != 0) { | 348 if (platform_context_.get() && transfer_buffer_id_ != 0) { |
348 platform_context_->GetCommandBuffer()->DestroyTransferBuffer( | 349 platform_context_->GetCommandBuffer()->DestroyTransferBuffer( |
349 transfer_buffer_id_); | 350 transfer_buffer_id_); |
350 transfer_buffer_id_ = 0; | 351 transfer_buffer_id_ = 0; |
351 } | 352 } |
352 | 353 |
353 helper_.reset(); | 354 helper_.reset(); |
354 platform_context_.reset(); | 355 platform_context_.reset(); |
355 } | 356 } |
356 | 357 |
357 void PPB_Context3D_Impl::OnContextLost() { | 358 void PPB_Context3D_Impl::OnContextLost() { |
358 if (draw_surface_) | 359 if (draw_surface_) |
359 draw_surface_->OnContextLost(); | 360 draw_surface_->OnContextLost(); |
360 if (read_surface_) | 361 if (read_surface_) |
361 read_surface_->OnContextLost(); | 362 read_surface_->OnContextLost(); |
362 } | 363 } |
363 | 364 |
364 } // namespace ppapi | 365 } // namespace ppapi |
365 } // namespace webkit | 366 } // namespace webkit |
OLD | NEW |