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

Unified Diff: mojo/public/cpp/system/handle.h

Issue 1932083002: Mojo: Use new message APIs to reduce copying (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/system/BUILD.gn ('k') | mojo/public/cpp/system/message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/system/handle.h
diff --git a/mojo/public/cpp/system/handle.h b/mojo/public/cpp/system/handle.h
index 519bcc1ea88a01f20c2c2dd8673d194b47d4f0ec..f83a9226f1891e2904341f54d01c75d32bfb8678 100644
--- a/mojo/public/cpp/system/handle.h
+++ b/mojo/public/cpp/system/handle.h
@@ -124,11 +124,8 @@ class ScopedHandleBase {
private:
void CloseIfNecessary() {
- if (!handle_.is_valid())
- return;
- MojoResult result = MojoClose(handle_.value());
- ALLOW_UNUSED_LOCAL(result);
- DCHECK_EQ(MOJO_RESULT_OK, result);
+ if (handle_.is_valid())
+ handle_.Close();
}
HandleType handle_;
@@ -162,6 +159,13 @@ class Handle {
MojoHandle* mutable_value() { return &value_; }
void set_value(MojoHandle value) { value_ = value; }
+ void Close() {
+ DCHECK(is_valid());
+ MojoResult result = MojoClose(value_);
+ ALLOW_UNUSED_LOCAL(result);
+ DCHECK_EQ(MOJO_RESULT_OK, result);
+ }
+
private:
MojoHandle value_;
« no previous file with comments | « mojo/public/cpp/system/BUILD.gn ('k') | mojo/public/cpp/system/message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698