| 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 "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 7 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 8 #include "third_party/skia/include/gpu/GrContext.h" | 8 #include "third_party/skia/include/gpu/GrContext.h" |
| 9 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" | 9 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
| 10 | 10 |
| 11 namespace webkit { | 11 namespace webkit { |
| 12 namespace gpu { | 12 namespace gpu { |
| 13 | 13 |
| 14 static void BindWebGraphicsContext3DGLContextCallback( | 14 static void BindWebGraphicsContext3DGLContextCallback( |
| 15 const GrGLInterface* interface) { | 15 const GrGLInterface* interface) { |
| 16 reinterpret_cast<WebKit::WebGraphicsContext3D*>( | 16 reinterpret_cast<blink::WebGraphicsContext3D*>( |
| 17 interface->fCallbackData)->makeContextCurrent(); | 17 interface->fCallbackData)->makeContextCurrent(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 GrContextForWebGraphicsContext3D::GrContextForWebGraphicsContext3D( | 20 GrContextForWebGraphicsContext3D::GrContextForWebGraphicsContext3D( |
| 21 WebKit::WebGraphicsContext3D* context3d) { | 21 blink::WebGraphicsContext3D* context3d) { |
| 22 if (!context3d) | 22 if (!context3d) |
| 23 return; | 23 return; |
| 24 | 24 |
| 25 skia::RefPtr<GrGLInterface> interface = skia::AdoptRef( | 25 skia::RefPtr<GrGLInterface> interface = skia::AdoptRef( |
| 26 context3d->createGrGLInterface()); | 26 context3d->createGrGLInterface()); |
| 27 if (!interface) | 27 if (!interface) |
| 28 return; | 28 return; |
| 29 | 29 |
| 30 interface->fCallback = BindWebGraphicsContext3DGLContextCallback; | 30 interface->fCallback = BindWebGraphicsContext3DGLContextCallback; |
| 31 interface->fCallbackData = | 31 interface->fCallbackData = |
| (...skipping 29 matching lines...) Expand all Loading... |
| 61 gr_context_->setTextureCacheLimits( | 61 gr_context_->setTextureCacheLimits( |
| 62 kMaxGaneshTextureCacheCount, kMaxGaneshTextureCacheBytes); | 62 kMaxGaneshTextureCacheCount, kMaxGaneshTextureCacheBytes); |
| 63 } else { | 63 } else { |
| 64 gr_context_->freeGpuResources(); | 64 gr_context_->freeGpuResources(); |
| 65 gr_context_->setTextureCacheLimits(0, 0); | 65 gr_context_->setTextureCacheLimits(0, 0); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace gpu | 69 } // namespace gpu |
| 70 } // namespace webkit | 70 } // namespace webkit |
| OLD | NEW |