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

Side by Side Diff: mojo/edk/system/core.h

Issue 1052723003: NaCl: create a separate namespace for Mojo handles. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Edits Created 5 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 MOJO_EDK_SYSTEM_CORE_H_ 5 #ifndef MOJO_EDK_SYSTEM_CORE_H_
6 #define MOJO_EDK_SYSTEM_CORE_H_ 6 #define MOJO_EDK_SYSTEM_CORE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 virtual ~Core(); 45 virtual ~Core();
46 46
47 // Adds |dispatcher| to the handle table, returning the handle for it. Returns 47 // Adds |dispatcher| to the handle table, returning the handle for it. Returns
48 // |MOJO_HANDLE_INVALID| on failure, namely if the handle table is full. 48 // |MOJO_HANDLE_INVALID| on failure, namely if the handle table is full.
49 MojoHandle AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher); 49 MojoHandle AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher);
50 50
51 // Looks up the dispatcher for the given handle. Returns null if the handle is 51 // Looks up the dispatcher for the given handle. Returns null if the handle is
52 // invalid. 52 // invalid.
53 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); 53 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle);
54 54
55 // Like |GetDispatcher()|, but also removes the handle from the handle table.
56 // On success, gets the dispatcher for a given handle (which should not be
57 // |MOJO_HANDLE_INVALID|) and removes it. (On failure, returns an appropriate
58 // result (and leaves |dispatcher| alone), namely
59 // |MOJO_RESULT_INVALID_ARGUMENT| if there's no dispatcher for the given
60 // handle or |MOJO_RESULT_BUSY| if the handle is marked as busy.)
61 MojoResult GetAndRemoveDispatcher(MojoHandle handle,
62 scoped_refptr<Dispatcher>* dispatcher);
63
55 // Watches on the given handle for the given signals, calling |callback| when 64 // Watches on the given handle for the given signals, calling |callback| when
56 // a signal is satisfied or when all signals become unsatisfiable. |callback| 65 // a signal is satisfied or when all signals become unsatisfiable. |callback|
57 // must satisfy stringent requirements -- see |Awakable::Awake()| in 66 // must satisfy stringent requirements -- see |Awakable::Awake()| in
58 // awakable.h. In particular, it must not call any Mojo system functions. 67 // awakable.h. In particular, it must not call any Mojo system functions.
59 MojoResult AsyncWait(MojoHandle handle, 68 MojoResult AsyncWait(MojoHandle handle,
60 MojoHandleSignals signals, 69 MojoHandleSignals signals,
61 const base::Callback<void(MojoResult)>& callback); 70 const base::Callback<void(MojoResult)>& callback);
62 71
63 embedder::PlatformSupport* platform_support() const { 72 embedder::PlatformSupport* platform_support() const {
64 return platform_support_; 73 return platform_support_;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 base::Lock mapping_table_lock_; // Protects |mapping_table_|. 183 base::Lock mapping_table_lock_; // Protects |mapping_table_|.
175 MappingTable mapping_table_; 184 MappingTable mapping_table_;
176 185
177 DISALLOW_COPY_AND_ASSIGN(Core); 186 DISALLOW_COPY_AND_ASSIGN(Core);
178 }; 187 };
179 188
180 } // namespace system 189 } // namespace system
181 } // namespace mojo 190 } // namespace mojo
182 191
183 #endif // MOJO_EDK_SYSTEM_CORE_H_ 192 #endif // MOJO_EDK_SYSTEM_CORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698