| OLD | NEW |
| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 return false; | 305 return false; |
| 306 if (shared_state_handle) | 306 if (shared_state_handle) |
| 307 *shared_state_handle = command_buffer_->GetSharedStateHandle(); | 307 *shared_state_handle = command_buffer_->GetSharedStateHandle(); |
| 308 if (capabilities) | 308 if (capabilities) |
| 309 *capabilities = command_buffer_->GetCapabilities(); | 309 *capabilities = command_buffer_->GetCapabilities(); |
| 310 mailbox_ = gpu::Mailbox::Generate(); | 310 mailbox_ = gpu::Mailbox::Generate(); |
| 311 if (!command_buffer_->ProduceFrontBuffer(mailbox_)) | 311 if (!command_buffer_->ProduceFrontBuffer(mailbox_)) |
| 312 return false; | 312 return false; |
| 313 sync_point_ = command_buffer_->InsertSyncPoint(); | 313 sync_point_ = command_buffer_->InsertSyncPoint(); |
| 314 | 314 |
| 315 command_buffer_->SetChannelErrorCallback(base::Bind( | 315 command_buffer_->SetContextLostCallback(base::Bind( |
| 316 &PPB_Graphics3D_Impl::OnContextLost, weak_ptr_factory_.GetWeakPtr())); | 316 &PPB_Graphics3D_Impl::OnContextLost, weak_ptr_factory_.GetWeakPtr())); |
| 317 | 317 |
| 318 command_buffer_->SetOnConsoleMessageCallback(base::Bind( | 318 command_buffer_->SetOnConsoleMessageCallback(base::Bind( |
| 319 &PPB_Graphics3D_Impl::OnConsoleMessage, weak_ptr_factory_.GetWeakPtr())); | 319 &PPB_Graphics3D_Impl::OnConsoleMessage, weak_ptr_factory_.GetWeakPtr())); |
| 320 return true; | 320 return true; |
| 321 } | 321 } |
| 322 | 322 |
| 323 void PPB_Graphics3D_Impl::OnConsoleMessage(const std::string& message, int id) { | 323 void PPB_Graphics3D_Impl::OnConsoleMessage(const std::string& message, int id) { |
| 324 if (!bound_to_instance_) | 324 if (!bound_to_instance_) |
| 325 return; | 325 return; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); | 378 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); |
| 379 // We have to check *again* that the instance exists, because it could have | 379 // We have to check *again* that the instance exists, because it could have |
| 380 // been deleted during GetPluginInterface(). Even the PluginModule could be | 380 // been deleted during GetPluginInterface(). Even the PluginModule could be |
| 381 // deleted, but in that case, the instance should also be gone, so the | 381 // deleted, but in that case, the instance should also be gone, so the |
| 382 // GetInstance check covers both cases. | 382 // GetInstance check covers both cases. |
| 383 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) | 383 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) |
| 384 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); | 384 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); |
| 385 } | 385 } |
| 386 | 386 |
| 387 } // namespace content | 387 } // namespace content |
| OLD | NEW |