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

Side by Side Diff: base/mac/dispatch_source_mach.h

Issue 1136953012: Move DispatchSourceMach from //sandbox/mac to //base/mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « base/base.gypi ('k') | base/mac/dispatch_source_mach.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef SANDBOX_MAC_DISPATCH_SOURCE_MACH_H_ 5 #ifndef BASE_MAC_DISPATCH_SOURCE_MACH_H_
6 #define SANDBOX_MAC_DISPATCH_SOURCE_MACH_H_ 6 #define BASE_MAC_DISPATCH_SOURCE_MACH_H_
7 7
8 #include <dispatch/dispatch.h> 8 #include <dispatch/dispatch.h>
9 9
10 #include "base/base_export.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "sandbox/sandbox_export.h"
12 12
13 namespace sandbox { 13 namespace base {
14 14
15 // This class encapsulates a MACH_RECV dispatch source. When this object is 15 // This class encapsulates a MACH_RECV dispatch source. When this object is
16 // destroyed, the source will be cancelled and it will wait for the source 16 // destroyed, the source will be cancelled and it will wait for the source
17 // to stop executing work. The source can run on either a user-supplied queue, 17 // to stop executing work. The source can run on either a user-supplied queue,
18 // or it can create its own for the source. 18 // or it can create its own for the source.
19 class SANDBOX_EXPORT DispatchSourceMach { 19 class BASE_EXPORT DispatchSourceMach {
20 public: 20 public:
21 // Creates a new dispatch source for the |port| and schedules it on a new 21 // Creates a new dispatch source for the |port| and schedules it on a new
22 // queue that will be created with |name|. When a Mach message is received, 22 // queue that will be created with |name|. When a Mach message is received,
23 // the |event_handler| will be called. 23 // the |event_handler| will be called.
24 DispatchSourceMach(const char* name, 24 DispatchSourceMach(const char* name,
25 mach_port_t port, 25 mach_port_t port,
26 void (^event_handler)()); 26 void (^event_handler)());
27 27
28 // Creates a new dispatch source with the same semantics as above, but rather 28 // Creates a new dispatch source with the same semantics as above, but rather
29 // than creating a new queue, it schedules the source on |queue|. 29 // than creating a new queue, it schedules the source on |queue|.
(...skipping 19 matching lines...) Expand all
49 49
50 // A MACH_RECV dispatch source. 50 // A MACH_RECV dispatch source.
51 dispatch_source_t source_; 51 dispatch_source_t source_;
52 52
53 // Semaphore used to wait on the |source_|'s cancellation in the destructor. 53 // Semaphore used to wait on the |source_|'s cancellation in the destructor.
54 dispatch_semaphore_t source_canceled_; 54 dispatch_semaphore_t source_canceled_;
55 55
56 DISALLOW_COPY_AND_ASSIGN(DispatchSourceMach); 56 DISALLOW_COPY_AND_ASSIGN(DispatchSourceMach);
57 }; 57 };
58 58
59 } // namespace sandbox 59 } // namespace base
60 60
61 #endif // SANDBOX_MAC_DISPATCH_SOURCE_MACH_H_ 61 #endif // BASE_MAC_DISPATCH_SOURCE_MACH_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/mac/dispatch_source_mach.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698