| Index: android_webview/browser/gl_surface_factory.cc
|
| diff --git a/android_webview/browser/gl_surface_factory.cc b/android_webview/browser/gl_surface_factory.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fdcc0dcfdcfea2f729929d0cb011a3a9e220f529
|
| --- /dev/null
|
| +++ b/android_webview/browser/gl_surface_factory.cc
|
| @@ -0,0 +1,43 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "android_webview/browser/gl_surface_factory.h"
|
| +
|
| +#include "ui/gl/gl_bindings.h"
|
| +
|
| +namespace android_webview {
|
| +
|
| +namespace {
|
| +// Intentionally leaky.
|
| +GLSurfaceFactory* g_gl_surface_factory = 0;
|
| +} // namespace
|
| +
|
| +// static
|
| +GLSurfaceFactory* GLSurfaceFactory::GetInstance() {
|
| + if (!g_gl_surface_factory)
|
| + g_gl_surface_factory = new GLSurfaceFactory;
|
| + return g_gl_surface_factory;
|
| +}
|
| +
|
| +GLSurfaceFactory::GLSurfaceFactory() {}
|
| +
|
| +GLSurfaceFactory::~GLSurfaceFactory() {}
|
| +
|
| +void GLSurfaceFactory::SetNextCallback(const CreateSurfaceCallback& callback) {
|
| + create_callback_ = callback;
|
| +}
|
| +
|
| +scoped_refptr<gfx::GLSurface> GLSurfaceFactory::CreateNonOwnedViewSurface() {
|
| + if (create_callback_.is_null()) {
|
| + LOG(WARNING) << "Creating on-screen surface not associated with a webview";
|
| + return NULL;
|
| + }
|
| + return create_callback_.Run();
|
| +}
|
| +
|
| +void GLSurfaceFactory::ResetCallback() {
|
| + create_callback_.Reset();
|
| +}
|
| +
|
| +} // namespace android_webview
|
|
|