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

Side by Side Diff: content/common/gpu/image_transport_surface_android.cc

Issue 1845563005: Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop ref to deleted content_tests_gypi_values.content_unittests_ozone_sources Created 4 years, 8 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "content/common/gpu/image_transport_surface.h"
6
7 #include "base/logging.h"
8 #include "content/common/gpu/pass_through_image_transport_surface.h"
9 #include "gpu/ipc/common/gpu_surface_lookup.h"
10 #include "ui/gl/gl_surface_egl.h"
11
12 namespace content {
13
14 // static
15 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(
16 GpuChannelManager* manager,
17 GpuCommandBufferStub* stub,
18 gpu::SurfaceHandle surface_handle,
19 gfx::GLSurface::Format format) {
20 DCHECK(gpu::GpuSurfaceLookup::GetInstance());
21 DCHECK_NE(surface_handle, gpu::kNullSurfaceHandle);
22 // On Android, the surface_handle is the id of the surface in the
23 // GpuSurfaceTracker/gpu::GpuSurfaceLookup
24 ANativeWindow* window =
25 gpu::GpuSurfaceLookup::GetInstance()->AcquireNativeWidget(surface_handle);
26 if (!window) {
27 LOG(WARNING) << "Failed to acquire native widget.";
28 return nullptr;
29 }
30 scoped_refptr<gfx::GLSurface> surface =
31 new gfx::NativeViewGLSurfaceEGL(window);
32 bool initialize_success = surface->Initialize(format);
33 ANativeWindow_release(window);
34 if (!initialize_success)
35 return scoped_refptr<gfx::GLSurface>();
36
37 return scoped_refptr<gfx::GLSurface>(
38 new PassThroughImageTransportSurface(manager, stub, surface.get()));
39 }
40
41 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface.h ('k') | content/common/gpu/image_transport_surface_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698