Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: android_webview/browser/gl_surface_factory.cc

Issue 22277004: Add gfx::SurfaceFactoryWebview (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: null out on detach Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698