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

Unified Diff: content/browser/browser_io_surface_manager_mac.h

Issue 1532813002: Replace IOSurfaceManager by directly passing IOSurface Mach ports over Chrome IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 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/bootstrap_sandbox_manager_mac.cc ('k') | content/browser/browser_io_surface_manager_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_io_surface_manager_mac.h
diff --git a/content/browser/browser_io_surface_manager_mac.h b/content/browser/browser_io_surface_manager_mac.h
deleted file mode 100644
index 021d6fd099a352922e1121eb28108db44223d702..0000000000000000000000000000000000000000
--- a/content/browser/browser_io_surface_manager_mac.h
+++ /dev/null
@@ -1,130 +0,0 @@
-// 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.
-
-#ifndef CONTENT_BROWSER_BROWSER_IO_SURFACE_MANAGER_MAC_H_
-#define CONTENT_BROWSER_BROWSER_IO_SURFACE_MANAGER_MAC_H_
-
-#include <IOSurface/IOSurface.h>
-#include <mach/mach.h>
-
-#include <map>
-#include <utility>
-
-#include "base/containers/scoped_ptr_hash_map.h"
-#include "base/mac/dispatch_source_mach.h"
-#include "base/mac/scoped_cftyperef.h"
-#include "base/mac/scoped_mach_port.h"
-#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/singleton.h"
-#include "base/synchronization/lock.h"
-#include "content/common/content_export.h"
-#include "content/common/mac/io_surface_manager_messages.h"
-#include "content/common/mac/io_surface_manager_token.h"
-#include "ui/gfx/mac/io_surface_manager.h"
-
-namespace content {
-
-// TODO(ericrk): Use gfx::GenericSharedMemoryId as the |io_surface_id| in
-// this file. Allows for more type-safe usage of GpuMemoryBufferIds as the
-// type of the |io_surface_id|, as it is a typedef of
-// gfx::GenericSharedMemoryId.
-
-// Implementation of IOSurfaceManager that provides a mechanism for child
-// processes to register and acquire IOSurfaces through a Mach service.
-class CONTENT_EXPORT BrowserIOSurfaceManager : public gfx::IOSurfaceManager {
- public:
- // Returns the global BrowserIOSurfaceManager.
- static BrowserIOSurfaceManager* GetInstance();
-
- // Look up the IOSurfaceManager service port that's been registered with
- // the bootstrap server. |pid| is the process ID of the service.
- static base::mac::ScopedMachSendRight LookupServicePort(pid_t pid);
-
- // Returns the name of the service registered with the bootstrap server.
- static std::string GetMachPortName();
-
- // Overridden from IOSurfaceManager:
- bool RegisterIOSurface(gfx::IOSurfaceId io_surface_id,
- int client_id,
- IOSurfaceRef io_surface) override;
- void UnregisterIOSurface(gfx::IOSurfaceId io_surface_id,
- int client_id) override;
- IOSurfaceRef AcquireIOSurface(gfx::IOSurfaceId io_surface_id) override;
-
- // Performs any necessary setup that cannot happen in the constructor.
- void EnsureRunning();
-
- // Generate a unique unguessable token that the GPU process can use to
- // register/unregister IOSurface for use by clients.
- IOSurfaceManagerToken GenerateGpuProcessToken();
-
- // Invalidate the previously generated GPU process token.
- void InvalidateGpuProcessToken();
-
- // Generate a unique unguessable token that the child process associated
- // |child_process_id| can use to acquire IOSurface references.
- IOSurfaceManagerToken GenerateChildProcessToken(int child_process_id);
-
- // Invalidate a previously generated child process token.
- void InvalidateChildProcessToken(const IOSurfaceManagerToken& token);
-
- private:
- friend class BrowserIOSurfaceManagerTest;
- friend struct base::DefaultSingletonTraits<BrowserIOSurfaceManager>;
-
- BrowserIOSurfaceManager();
- ~BrowserIOSurfaceManager() override;
-
- // Performs any initialization work.
- bool Initialize();
-
- // Message handler that is invoked on |dispatch_source_| when an
- // incoming message needs to be received.
- void HandleRequest();
-
- // Message handlers that are invoked from HandleRequest.
- void HandleRegisterIOSurfaceRequest(
- const IOSurfaceManagerHostMsg_RegisterIOSurface& request,
- IOSurfaceManagerMsg_RegisterIOSurfaceReply* reply);
- bool HandleUnregisterIOSurfaceRequest(
- const IOSurfaceManagerHostMsg_UnregisterIOSurface& request);
- void HandleAcquireIOSurfaceRequest(
- const IOSurfaceManagerHostMsg_AcquireIOSurface& request,
- IOSurfaceManagerMsg_AcquireIOSurfaceReply* reply);
-
- // Whether or not the class has been initialized.
- bool initialized_;
-
- // The Mach port on which the server listens.
- base::mac::ScopedMachReceiveRight server_port_;
-
- // The dispatch source and queue on which Mach messages will be received.
- scoped_ptr<base::DispatchSourceMach> dispatch_source_;
-
- // Stores the IOSurfaces for all GPU clients. The key contains the IOSurface
- // id and the Child process unique id of the owner.
- using IOSurfaceMapKey = std::pair<gfx::IOSurfaceId, int>;
- using IOSurfaceMap =
- std::map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>>;
- IOSurfaceMap io_surfaces_;
-
- // Stores the Child process unique id (RenderProcessHost ID) for every
- // token.
- using ChildProcessIdMap = std::map<IOSurfaceManagerToken, int>;
- ChildProcessIdMap child_process_ids_;
-
- // Stores the GPU process token.
- IOSurfaceManagerToken gpu_process_token_;
-
- // Mutex that guards |initialized_|, |io_surfaces_|, |child_process_ids_|
- // and |gpu_process_token_|.
- base::Lock lock_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserIOSurfaceManager);
-};
-
-} // namespace content
-
-#endif // CONTENT_BROWSER_BROWSER_IO_SURFACE_MANAGER_MAC_H_
« no previous file with comments | « content/browser/bootstrap_sandbox_manager_mac.cc ('k') | content/browser/browser_io_surface_manager_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698