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

Unified Diff: content/browser/in_process_io_surface_manager_mac.cc

Issue 1120873002: Re-land: content: Single process support for native GpuMemoryBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dm-browsertests-refactor
Patch Set: disable test for now Created 5 years, 6 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/browser/in_process_io_surface_manager_mac.h ('k') | content/child/child_thread_impl_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/in_process_io_surface_manager_mac.cc
diff --git a/content/browser/in_process_io_surface_manager_mac.cc b/content/browser/in_process_io_surface_manager_mac.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ca387859d46d3b47eda8418949d5d74edafcec4e
--- /dev/null
+++ b/content/browser/in_process_io_surface_manager_mac.cc
@@ -0,0 +1,50 @@
+// 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/browser/in_process_io_surface_manager_mac.h"
+
+#include "base/logging.h"
+
+namespace content {
+
+// static
+InProcessIOSurfaceManager* InProcessIOSurfaceManager::GetInstance() {
+ return Singleton<InProcessIOSurfaceManager,
+ LeakySingletonTraits<InProcessIOSurfaceManager>>::get();
+}
+
+bool InProcessIOSurfaceManager::RegisterIOSurface(int io_surface_id,
+ int client_id,
+ IOSurfaceRef io_surface) {
+ base::AutoLock lock(lock_);
+
+ DCHECK(io_surfaces_.find(io_surface_id) == io_surfaces_.end());
+ io_surfaces_.add(io_surface_id,
+ make_scoped_ptr(new base::mac::ScopedMachSendRight(
+ IOSurfaceCreateMachPort(io_surface))));
+ return true;
+}
+
+void InProcessIOSurfaceManager::UnregisterIOSurface(int io_surface_id,
+ int client_id) {
+ base::AutoLock lock(lock_);
+
+ DCHECK(io_surfaces_.find(io_surface_id) != io_surfaces_.end());
+ io_surfaces_.erase(io_surface_id);
+}
+
+IOSurfaceRef InProcessIOSurfaceManager::AcquireIOSurface(int io_surface_id) {
+ base::AutoLock lock(lock_);
+
+ DCHECK(io_surfaces_.find(io_surface_id) != io_surfaces_.end());
+ return IOSurfaceLookupFromMachPort(io_surfaces_.get(io_surface_id)->get());
+}
+
+InProcessIOSurfaceManager::InProcessIOSurfaceManager() {
+}
+
+InProcessIOSurfaceManager::~InProcessIOSurfaceManager() {
+}
+
+} // namespace content
« no previous file with comments | « content/browser/in_process_io_surface_manager_mac.h ('k') | content/child/child_thread_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698