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

Side by Side Diff: chrome/browser/chromeos/dbus/chrome_surface_service_provider_delegate.cc

Issue 1394573003: chromeos: Add SurfaceServiceProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 2015 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 "chrome/browser/chromeos/dbus/chrome_surface_service_provider_delegate. h"
6
7 #include "ash/shell.h"
8 #include "ash/surfaces/surface_controller.h"
9 #include "ash/surfaces/test_surface_overlay_view.h"
10 #include "ui/gfx/gpu_memory_buffer.h"
11
12 namespace chromeos {
13
14 ChromeSurfaceServiceProviderDelegate::ChromeSurfaceServiceProviderDelegate() {}
15
16 ChromeSurfaceServiceProviderDelegate::~ChromeSurfaceServiceProviderDelegate() {}
17
18 void ChromeSurfaceServiceProviderDelegate::CreateGraphicsBufferFromUnixFd(
19 const gfx::Size& size,
20 base::ScopedFD fd,
21 int stride,
22 const GraphicsBufferCreatedCallback& callback) {
23 gfx::GpuMemoryBufferHandle handle;
24 handle.type = gfx::OZONE_NATIVE_PIXMAP;
25 handle.native_pixmap_handle.fd = base::FileDescriptor(fd.Pass());
26 handle.native_pixmap_handle.stride = stride;
27 ash::Shell::GetInstance()
28 ->surface_controller()
29 ->CreateGraphicsBufferFromGpuMemoryBufferHandle(
30 handle, size, gfx::BufferFormat::BGRA_8888, callback);
31 }
32
33 void ChromeSurfaceServiceProviderDelegate::DestroyGraphicsBuffer(int32 buffer) {
34 ash::Shell::GetInstance()->surface_controller()->DestroyGraphicsBuffer(
35 buffer);
36 }
37
38 void ChromeSurfaceServiceProviderDelegate::SetTestSurfaceContents(
39 int32 buffer) {
40 ash::Shell::GetInstance()->surface_controller()->SetTestSurfaceContents(
41 buffer);
42 }
43
44 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698