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/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 namespace content { | 39 namespace content { |
40 | 40 |
41 PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance) | 41 PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance) |
42 : PPB_Graphics3D_Shared(instance), | 42 : PPB_Graphics3D_Shared(instance), |
43 bound_to_instance_(false), | 43 bound_to_instance_(false), |
44 commit_pending_(false), | 44 commit_pending_(false), |
45 has_alpha_(false), | 45 has_alpha_(false), |
46 weak_ptr_factory_(this) {} | 46 weak_ptr_factory_(this) {} |
47 | 47 |
48 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { | 48 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { |
49 command_buffer_->SetGpuControlClient(nullptr); | 49 // Unset the client before the command_buffer_ is destroyed, similar to how |
| 50 // WeakPtrFactory invalidates before it. |
| 51 if (command_buffer_) |
| 52 command_buffer_->SetGpuControlClient(nullptr); |
50 } | 53 } |
51 | 54 |
52 // static | 55 // static |
53 PP_Resource PPB_Graphics3D_Impl::CreateRaw( | 56 PP_Resource PPB_Graphics3D_Impl::CreateRaw( |
54 PP_Instance instance, | 57 PP_Instance instance, |
55 PP_Resource share_context, | 58 PP_Resource share_context, |
56 const int32_t* attrib_list, | 59 const int32_t* attrib_list, |
57 gpu::Capabilities* capabilities, | 60 gpu::Capabilities* capabilities, |
58 base::SharedMemoryHandle* shared_state_handle, | 61 base::SharedMemoryHandle* shared_state_handle, |
59 gpu::CommandBufferId* command_buffer_id) { | 62 gpu::CommandBufferId* command_buffer_id) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); | 333 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); |
331 // We have to check *again* that the instance exists, because it could have | 334 // We have to check *again* that the instance exists, because it could have |
332 // been deleted during GetPluginInterface(). Even the PluginModule could be | 335 // been deleted during GetPluginInterface(). Even the PluginModule could be |
333 // deleted, but in that case, the instance should also be gone, so the | 336 // deleted, but in that case, the instance should also be gone, so the |
334 // GetInstance check covers both cases. | 337 // GetInstance check covers both cases. |
335 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) | 338 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) |
336 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); | 339 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); |
337 } | 340 } |
338 | 341 |
339 } // namespace content | 342 } // namespace content |
OLD | NEW |