Style/readability clean-up for certificate reporting code
[chromium-blink-merge.git] / content / browser / in_process_io_surface_manager_mac.cc
blobca387859d46d3b47eda8418949d5d74edafcec4e
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 #include "content/browser/in_process_io_surface_manager_mac.h"
7 #include "base/logging.h"
9 namespace content {
11 // static
12 InProcessIOSurfaceManager* InProcessIOSurfaceManager::GetInstance() {
13 return Singleton<InProcessIOSurfaceManager,
14 LeakySingletonTraits<InProcessIOSurfaceManager>>::get();
17 bool InProcessIOSurfaceManager::RegisterIOSurface(int io_surface_id,
18 int client_id,
19 IOSurfaceRef io_surface) {
20 base::AutoLock lock(lock_);
22 DCHECK(io_surfaces_.find(io_surface_id) == io_surfaces_.end());
23 io_surfaces_.add(io_surface_id,
24 make_scoped_ptr(new base::mac::ScopedMachSendRight(
25 IOSurfaceCreateMachPort(io_surface))));
26 return true;
29 void InProcessIOSurfaceManager::UnregisterIOSurface(int io_surface_id,
30 int client_id) {
31 base::AutoLock lock(lock_);
33 DCHECK(io_surfaces_.find(io_surface_id) != io_surfaces_.end());
34 io_surfaces_.erase(io_surface_id);
37 IOSurfaceRef InProcessIOSurfaceManager::AcquireIOSurface(int io_surface_id) {
38 base::AutoLock lock(lock_);
40 DCHECK(io_surfaces_.find(io_surface_id) != io_surfaces_.end());
41 return IOSurfaceLookupFromMachPort(io_surfaces_.get(io_surface_id)->get());
44 InProcessIOSurfaceManager::InProcessIOSurfaceManager() {
47 InProcessIOSurfaceManager::~InProcessIOSurfaceManager() {
50 } // namespace content