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

Side by Side Diff: content/child/child_native_pixmap_manager_ozone.cc

Issue 1248713002: ozone: ClientPixmapManager passes VGEM fd from browser to renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to lastest crrev.com/1128113011 Created 5 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
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 "content/child/child_native_pixmap_manager_ozone.h"
6
7 #include "base/file_descriptor_posix.h"
8 #include "base/lazy_instance.h"
9 #include "base/synchronization/lock.h"
10 #include "content/common/gpu/native_pixmap_manager_ozone_messages.h"
11
12 namespace content {
13
14 namespace {
15 base::LazyInstance<base::Lock> g_creation_lock = LAZY_INSTANCE_INITIALIZER;
16 }
17
18 // static
19 void ChildNativePixmapManager::CreateSingleton(ThreadSafeSender* sender) {
20 base::AutoLock lock(g_creation_lock.Get());
21 if (ui::NativePixmapManager::GetInstance())
22 return;
23
24 TRACE_EVENT0("renderer", "ChildNativePixmapManager::Create");
25 DCHECK(sender);
26 scoped_ptr<ChildNativePixmapManager> manager(new ChildNativePixmapManager());
27
28 base::FileDescriptor virtual_device;
29 IPC::Message* message =
30 new BrowserNativePixmapManagerMsg_SyncGetVirtualDevice(&virtual_device);
31 bool success = sender->Send(message);
32 if (!success) {
33 LOG(ERROR)
34 << "Fail to send BrowserNativePixmapManagerMsg_SyncGetVirtualDevice";
35 return;
36 }
37
38 manager->Initialize(virtual_device);
39 ui::NativePixmapManager::SetInstance(manager.release());
40 }
41
42 ChildNativePixmapManager::ChildNativePixmapManager() {}
43
44 ChildNativePixmapManager::~ChildNativePixmapManager() {}
45
46 void ChildNativePixmapManager::Initialize(
47 const base::FileDescriptor& device_fd) {
48 pixmap_manager_ = ui::NativePixmapManager::Create(device_fd);
49 }
50
51 std::vector<ui::NativePixmapManager::Configuration>
52 ChildNativePixmapManager::GetSupportedNativePixmapConfigurations() const {
53 return pixmap_manager_->GetSupportedNativePixmapConfigurations();
54 }
55
56 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_native_pixmap_manager_ozone.h ('k') | content/common/content_message_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698