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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_native_pixmap_manager_ozone.cc
diff --git a/content/child/child_native_pixmap_manager_ozone.cc b/content/child/child_native_pixmap_manager_ozone.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4701dcc46acd7f612713e5519d3777adb532f527
--- /dev/null
+++ b/content/child/child_native_pixmap_manager_ozone.cc
@@ -0,0 +1,56 @@
+// Copyright 2015 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 "content/child/child_native_pixmap_manager_ozone.h"
+
+#include "base/file_descriptor_posix.h"
+#include "base/lazy_instance.h"
+#include "base/synchronization/lock.h"
+#include "content/common/gpu/native_pixmap_manager_ozone_messages.h"
+
+namespace content {
+
+namespace {
+base::LazyInstance<base::Lock> g_creation_lock = LAZY_INSTANCE_INITIALIZER;
+}
+
+// static
+void ChildNativePixmapManager::CreateSingleton(ThreadSafeSender* sender) {
+ base::AutoLock lock(g_creation_lock.Get());
+ if (ui::NativePixmapManager::GetInstance())
+ return;
+
+ TRACE_EVENT0("renderer", "ChildNativePixmapManager::Create");
+ DCHECK(sender);
+ scoped_ptr<ChildNativePixmapManager> manager(new ChildNativePixmapManager());
+
+ base::FileDescriptor virtual_device;
+ IPC::Message* message =
+ new BrowserNativePixmapManagerMsg_SyncGetVirtualDevice(&virtual_device);
+ bool success = sender->Send(message);
+ if (!success) {
+ LOG(ERROR)
+ << "Fail to send BrowserNativePixmapManagerMsg_SyncGetVirtualDevice";
+ return;
+ }
+
+ manager->Initialize(virtual_device);
+ ui::NativePixmapManager::SetInstance(manager.release());
+}
+
+ChildNativePixmapManager::ChildNativePixmapManager() {}
+
+ChildNativePixmapManager::~ChildNativePixmapManager() {}
+
+void ChildNativePixmapManager::Initialize(
+ const base::FileDescriptor& device_fd) {
+ pixmap_manager_ = ui::NativePixmapManager::Create(device_fd);
+}
+
+std::vector<ui::NativePixmapManager::Configuration>
+ChildNativePixmapManager::GetSupportedNativePixmapConfigurations() const {
+ return pixmap_manager_->GetSupportedNativePixmapConfigurations();
+}
+
+} // namespace content
« 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