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

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

Issue 56553002: Say "noto" goto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/shell/app_container.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 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_PUBLIC_SYSTEM_CORE_H_ 5 #ifndef MOJO_PUBLIC_SYSTEM_CORE_H_
6 #define MOJO_PUBLIC_SYSTEM_CORE_H_ 6 #define MOJO_PUBLIC_SYSTEM_CORE_H_
7 7
8 // Note: This header should be compilable as C. 8 // Note: This header should be compilable as C.
9 9
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 inline MojoResult ReadMessage(Handle handle, 303 inline MojoResult ReadMessage(Handle handle,
304 void* bytes, uint32_t* num_bytes, 304 void* bytes, uint32_t* num_bytes,
305 Handle* handles, uint32_t* num_handles, 305 Handle* handles, uint32_t* num_handles,
306 MojoReadMessageFlags flags) { 306 MojoReadMessageFlags flags) {
307 return MojoReadMessage(handle.value, 307 return MojoReadMessage(handle.value,
308 bytes, num_bytes, 308 bytes, num_bytes,
309 &handles[0].value, num_handles, 309 &handles[0].value, num_handles,
310 flags); 310 flags);
311 } 311 }
312 312
313 // Closes handle_ when deleted.
darin (slow to review) 2013/11/01 21:48:52 nit: how about breaking this out into its own head
314 // This probably wants tons of improvements, but those can be made as needed.
315 class ScopedHandle {
316 public:
317 ScopedHandle(Handle handle) : handle_(handle) {
318 }
319
320 ~ScopedHandle() {
321 if (handle_.value == kInvalidHandle.value)
322 return;
323 Close(handle_);
324 release();
325 }
326
327 Handle get() const { return handle_; }
328 Handle release() {
329 Handle temp = handle_;
330 handle_ = kInvalidHandle;
331 return temp;
332 }
333
334 private:
335 Handle handle_;
336 };
337
313 } // namespace mojo 338 } // namespace mojo
314 #endif 339 #endif
315 340
316 #endif // MOJO_PUBLIC_SYSTEM_CORE_H_ 341 #endif // MOJO_PUBLIC_SYSTEM_CORE_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/shell/app_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698