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 "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | 5 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 8 #include "gpu/command_buffer/client/gles2_lib.h" |
9 #include "third_party/skia/include/gpu/GrContext.h" | 9 #include "third_party/skia/include/gpu/GrContext.h" |
10 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" | 10 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
11 #include "webkit/common/gpu/webgraphicscontext3d_impl.h" | |
11 | 12 |
12 namespace webkit { | 13 namespace webkit { |
13 namespace gpu { | 14 namespace gpu { |
14 | 15 |
15 static void BindWebGraphicsContext3DGLContextCallback( | 16 static void BindWebGraphicsContext3DGLContextCallback( |
16 const GrGLInterface* interface) { | 17 const GrGLInterface* interface) { |
17 reinterpret_cast<blink::WebGraphicsContext3D*>( | 18 gles2::SetGLContext(reinterpret_cast<WebGraphicsContext3DImpl*>( |
18 interface->fCallbackData)->makeContextCurrent(); | 19 interface->fCallbackData)->GetGLInterface()); |
dshwang
2014/08/15 14:54:01
Now this file is only client that uses gles2::SetG
| |
19 } | 20 } |
20 | 21 |
21 GrContextForWebGraphicsContext3D::GrContextForWebGraphicsContext3D( | 22 GrContextForWebGraphicsContext3D::GrContextForWebGraphicsContext3D( |
22 blink::WebGraphicsContext3D* context3d) { | 23 WebGraphicsContext3DImpl* context3d) { |
23 if (!context3d) | 24 if (!context3d) |
24 return; | 25 return; |
25 | 26 |
27 gles2::SetGLContext(context3d->GetGLInterface()); | |
26 skia::RefPtr<GrGLInterface> interface = skia::AdoptRef( | 28 skia::RefPtr<GrGLInterface> interface = skia::AdoptRef( |
27 context3d->createGrGLInterface()); | 29 context3d->createGrGLInterface()); |
28 if (!interface) | 30 if (!interface) |
29 return; | 31 return; |
30 | 32 |
31 interface->fCallback = BindWebGraphicsContext3DGLContextCallback; | 33 interface->fCallback = BindWebGraphicsContext3DGLContextCallback; |
32 interface->fCallbackData = | 34 interface->fCallbackData = |
33 reinterpret_cast<GrGLInterfaceCallbackData>(context3d); | 35 reinterpret_cast<GrGLInterfaceCallbackData>(context3d); |
34 | 36 |
35 gr_context_ = skia::AdoptRef(GrContext::Create( | 37 gr_context_ = skia::AdoptRef(GrContext::Create( |
(...skipping 23 matching lines...) Expand all Loading... | |
59 void GrContextForWebGraphicsContext3D::FreeGpuResources() { | 61 void GrContextForWebGraphicsContext3D::FreeGpuResources() { |
60 if (gr_context_) { | 62 if (gr_context_) { |
61 TRACE_EVENT_INSTANT0("gpu", "GrContext::freeGpuResources", \ | 63 TRACE_EVENT_INSTANT0("gpu", "GrContext::freeGpuResources", \ |
62 TRACE_EVENT_SCOPE_THREAD); | 64 TRACE_EVENT_SCOPE_THREAD); |
63 gr_context_->freeGpuResources(); | 65 gr_context_->freeGpuResources(); |
64 } | 66 } |
65 } | 67 } |
66 | 68 |
67 } // namespace gpu | 69 } // namespace gpu |
68 } // namespace webkit | 70 } // namespace webkit |
OLD | NEW |