OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/common/gpu/client/grcontext_for_webgraphicscontext3d.h" | 5 #include "content/common/gpu/client/grcontext_for_webgraphicscontext3d.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string.h> | 8 #include <string.h> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
13 #include "gpu/blink/webgraphicscontext3d_impl.h" | 14 #include "gpu/blink/webgraphicscontext3d_impl.h" |
14 #include "gpu/command_buffer/client/gles2_lib.h" | 15 #include "gpu/command_buffer/client/gles2_lib.h" |
15 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" | 16 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" |
16 #include "third_party/skia/include/gpu/GrContext.h" | 17 #include "third_party/skia/include/gpu/GrContext.h" |
17 | 18 |
18 using gpu_blink::WebGraphicsContext3DImpl; | 19 using gpu_blink::WebGraphicsContext3DImpl; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 void GrContextForWebGraphicsContext3D::FreeGpuResources() { | 83 void GrContextForWebGraphicsContext3D::FreeGpuResources() { |
83 if (gr_context_) { | 84 if (gr_context_) { |
84 TRACE_EVENT_INSTANT0("gpu", "GrContext::freeGpuResources", \ | 85 TRACE_EVENT_INSTANT0("gpu", "GrContext::freeGpuResources", \ |
85 TRACE_EVENT_SCOPE_THREAD); | 86 TRACE_EVENT_SCOPE_THREAD); |
86 gr_context_->freeGpuResources(); | 87 gr_context_->freeGpuResources(); |
87 } | 88 } |
88 } | 89 } |
89 | 90 |
90 GrGLInterfaceForWebGraphicsContext3D::GrGLInterfaceForWebGraphicsContext3D( | 91 GrGLInterfaceForWebGraphicsContext3D::GrGLInterfaceForWebGraphicsContext3D( |
91 scoped_ptr<gpu_blink::WebGraphicsContext3DImpl> context3d) | 92 scoped_ptr<gpu_blink::WebGraphicsContext3DImpl> context3d) |
92 : context3d_(context3d.Pass()) { | 93 : context3d_(std::move(context3d)) {} |
93 } | |
94 | 94 |
95 void GrGLInterfaceForWebGraphicsContext3D::BindToCurrentThread() { | 95 void GrGLInterfaceForWebGraphicsContext3D::BindToCurrentThread() { |
96 context_thread_checker_.DetachFromThread(); | 96 context_thread_checker_.DetachFromThread(); |
97 } | 97 } |
98 | 98 |
99 GrGLInterfaceForWebGraphicsContext3D::~GrGLInterfaceForWebGraphicsContext3D() { | 99 GrGLInterfaceForWebGraphicsContext3D::~GrGLInterfaceForWebGraphicsContext3D() { |
100 DCHECK(context_thread_checker_.CalledOnValidThread()); | 100 DCHECK(context_thread_checker_.CalledOnValidThread()); |
101 #if !defined(NDEBUG) | 101 #if !defined(NDEBUG) |
102 // Set all the function pointers to zero, in order to crash if function | 102 // Set all the function pointers to zero, in order to crash if function |
103 // pointers are used after free. | 103 // pointers are used after free. |
104 memset(&fFunctions, 0, sizeof(GrGLInterface::Functions)); | 104 memset(&fFunctions, 0, sizeof(GrGLInterface::Functions)); |
105 #endif | 105 #endif |
106 } | 106 } |
107 | 107 |
108 } // namespace content | 108 } // namespace content |
OLD | NEW |