| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "android_webview/browser/gl_surface_factory.h" |
| 6 |
| 7 #include "ui/gl/gl_bindings.h" |
| 8 |
| 9 namespace android_webview { |
| 10 |
| 11 namespace { |
| 12 // Intentionally leaky. |
| 13 GLSurfaceFactory* g_gl_surface_factory = 0; |
| 14 } // namespace |
| 15 |
| 16 // static |
| 17 GLSurfaceFactory* GLSurfaceFactory::GetInstance() { |
| 18 if (!g_gl_surface_factory) |
| 19 g_gl_surface_factory = new GLSurfaceFactory; |
| 20 return g_gl_surface_factory; |
| 21 } |
| 22 |
| 23 GLSurfaceFactory::GLSurfaceFactory() {} |
| 24 |
| 25 GLSurfaceFactory::~GLSurfaceFactory() {} |
| 26 |
| 27 void GLSurfaceFactory::SetNextCallback(const CreateSurfaceCallback& callback) { |
| 28 create_callback_ = callback; |
| 29 } |
| 30 |
| 31 scoped_refptr<gfx::GLSurface> GLSurfaceFactory::CreateNonOwnedViewSurface() { |
| 32 if (create_callback_.is_null()) { |
| 33 LOG(WARNING) << "Creating on-screen surface not associated with a webview"; |
| 34 return NULL; |
| 35 } |
| 36 return create_callback_.Run(); |
| 37 } |
| 38 |
| 39 void GLSurfaceFactory::ResetCallback() { |
| 40 create_callback_.Reset(); |
| 41 } |
| 42 |
| 43 } // namespace android_webview |
| OLD | NEW |