Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / content / browser / in_process_io_surface_manager_mac.h
blobd2ef45a6623c6eca35048c69239ba79770b3f264
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.
5 #ifndef CONTENT_BROWSER_IN_PROCESS_IO_SURFACE_MANAGER_MAC_H_
6 #define CONTENT_BROWSER_IN_PROCESS_IO_SURFACE_MANAGER_MAC_H_
8 #include "base/containers/scoped_ptr_hash_map.h"
9 #include "base/mac/scoped_mach_port.h"
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/singleton.h"
13 #include "base/synchronization/lock.h"
14 #include "content/common/content_export.h"
15 #include "content/common/mac/io_surface_manager.h"
17 namespace content {
19 class CONTENT_EXPORT InProcessIOSurfaceManager : public IOSurfaceManager {
20 public:
21 static InProcessIOSurfaceManager* GetInstance();
23 // Overridden from IOSurfaceManager:
24 bool RegisterIOSurface(IOSurfaceId io_surface_id,
25 int client_id,
26 IOSurfaceRef io_surface) override;
27 void UnregisterIOSurface(IOSurfaceId io_surface_id, int client_id) override;
28 IOSurfaceRef AcquireIOSurface(IOSurfaceId io_surface_id) override;
30 private:
31 friend struct base::DefaultSingletonTraits<InProcessIOSurfaceManager>;
33 InProcessIOSurfaceManager();
34 ~InProcessIOSurfaceManager() override;
36 using IOSurfaceMap =
37 base::ScopedPtrHashMap<IOSurfaceId,
38 scoped_ptr<base::mac::ScopedMachSendRight>>;
39 IOSurfaceMap io_surfaces_;
40 base::Lock lock_;
42 DISALLOW_COPY_AND_ASSIGN(InProcessIOSurfaceManager);
45 } // namespace content
47 #endif // CONTENT_BROWSER_IN_PROCESS_IO_SURFACE_MANAGER_MAC_H_