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

Side by Side Diff: content/child/child_io_surface_manager_mac.cc

Issue 1312353002: content: Remove base::WaitableEvent from ChildIOSurfaceManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comments Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « content/child/child_io_surface_manager_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/child_io_surface_manager_mac.h" 5 #include "content/child/child_io_surface_manager_mac.h"
6 6
7 #include "base/mac/mach_logging.h" 7 #include "base/mac/mach_logging.h"
8 #include "content/common/mac/io_surface_manager_messages.h" 8 #include "content/common/mac/io_surface_manager_messages.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 mach_msg(&request.header, MACH_SEND_MSG, sizeof(request), 0, 86 mach_msg(&request.header, MACH_SEND_MSG, sizeof(request), 0,
87 MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); 87 MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
88 if (kr != KERN_SUCCESS) { 88 if (kr != KERN_SUCCESS) {
89 MACH_LOG(ERROR, kr) << "mach_msg"; 89 MACH_LOG(ERROR, kr) << "mach_msg";
90 } 90 }
91 } 91 }
92 92
93 IOSurfaceRef ChildIOSurfaceManager::AcquireIOSurface( 93 IOSurfaceRef ChildIOSurfaceManager::AcquireIOSurface(
94 IOSurfaceId io_surface_id) { 94 IOSurfaceId io_surface_id) {
95 DCHECK(service_port_.is_valid()); 95 DCHECK(service_port_.is_valid());
96
97 // A valid token is required to acquire an IOSurface. This will wait for a
98 // valid token if one has not yet been set.
99 set_token_event_.Wait();
100 #if !defined(NDEBUG)
101 DCHECK(!(set_token_thread_id_ == base::PlatformThread::CurrentRef()));
102 #endif
103 DCHECK(!token_.IsZero()); 96 DCHECK(!token_.IsZero());
104 97
105 mach_port_t reply_port; 98 mach_port_t reply_port;
106 kern_return_t kr = mach_port_allocate(mach_task_self(), 99 kern_return_t kr = mach_port_allocate(mach_task_self(),
107 MACH_PORT_RIGHT_RECEIVE, &reply_port); 100 MACH_PORT_RIGHT_RECEIVE, &reply_port);
108 if (kr != KERN_SUCCESS) { 101 if (kr != KERN_SUCCESS) {
109 MACH_LOG(ERROR, kr) << "mach_port_allocate"; 102 MACH_LOG(ERROR, kr) << "mach_port_allocate";
110 return nullptr; 103 return nullptr;
111 } 104 }
112 base::mac::ScopedMachReceiveRight scoped_receive_right(reply_port); 105 base::mac::ScopedMachReceiveRight scoped_receive_right(reply_port);
(...skipping 22 matching lines...) Expand all
135 return nullptr; 128 return nullptr;
136 } 129 }
137 130
138 // Deallocate the right after creating an IOSurface reference. 131 // Deallocate the right after creating an IOSurface reference.
139 base::mac::ScopedMachSendRight scoped_io_surface_right( 132 base::mac::ScopedMachSendRight scoped_io_surface_right(
140 data.reply.msg.io_surface_port.name); 133 data.reply.msg.io_surface_port.name);
141 134
142 return IOSurfaceLookupFromMachPort(scoped_io_surface_right); 135 return IOSurfaceLookupFromMachPort(scoped_io_surface_right);
143 } 136 }
144 137
145 ChildIOSurfaceManager::ChildIOSurfaceManager() 138 ChildIOSurfaceManager::ChildIOSurfaceManager() {}
146 : set_token_event_(true, false) {}
147 139
148 ChildIOSurfaceManager::~ChildIOSurfaceManager() { 140 ChildIOSurfaceManager::~ChildIOSurfaceManager() {}
149 }
150 141
151 } // namespace content 142 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_io_surface_manager_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698