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

Side by Side Diff: mojo/common/data_pipe_utils.cc

Issue 336313007: Mojo: Rename MOJO_WAIT_FLAG_... -> MOJO_HANDLE_SIGNAL_.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/bindings/js/core.cc ('k') | mojo/common/handle_watcher.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 #include "mojo/common/data_pipe_utils.h" 5 #include "mojo/common/data_pipe_utils.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 16 matching lines...) Expand all
27 uint32_t num_bytes; 27 uint32_t num_bytes;
28 MojoResult result = BeginReadDataRaw(source.get(), &buffer, &num_bytes, 28 MojoResult result = BeginReadDataRaw(source.get(), &buffer, &num_bytes,
29 MOJO_READ_DATA_FLAG_NONE); 29 MOJO_READ_DATA_FLAG_NONE);
30 if (result == MOJO_RESULT_OK) { 30 if (result == MOJO_RESULT_OK) {
31 size_t bytes_written = fwrite(buffer, 1, num_bytes, fp.get()); 31 size_t bytes_written = fwrite(buffer, 1, num_bytes, fp.get());
32 result = EndReadDataRaw(source.get(), num_bytes); 32 result = EndReadDataRaw(source.get(), num_bytes);
33 if (bytes_written < num_bytes || result != MOJO_RESULT_OK) 33 if (bytes_written < num_bytes || result != MOJO_RESULT_OK)
34 return false; 34 return false;
35 } else if (result == MOJO_RESULT_SHOULD_WAIT) { 35 } else if (result == MOJO_RESULT_SHOULD_WAIT) {
36 result = Wait(source.get(), 36 result = Wait(source.get(),
37 MOJO_WAIT_FLAG_READABLE, 37 MOJO_HANDLE_SIGNAL_READABLE,
38 MOJO_DEADLINE_INDEFINITE); 38 MOJO_DEADLINE_INDEFINITE);
39 if (result != MOJO_RESULT_OK) { 39 if (result != MOJO_RESULT_OK) {
40 // If the producer handle was closed, then treat as EOF. 40 // If the producer handle was closed, then treat as EOF.
41 return result == MOJO_RESULT_FAILED_PRECONDITION; 41 return result == MOJO_RESULT_FAILED_PRECONDITION;
42 } 42 }
43 } else if (result == MOJO_RESULT_FAILED_PRECONDITION) { 43 } else if (result == MOJO_RESULT_FAILED_PRECONDITION) {
44 // If the producer handle was closed, then treat as EOF. 44 // If the producer handle was closed, then treat as EOF.
45 return true; 45 return true;
46 } else { 46 } else {
47 // Some other error occurred. 47 // Some other error occurred.
(...skipping 15 matching lines...) Expand all
63 const base::Callback<void(bool)>& callback) { 63 const base::Callback<void(bool)>& callback) {
64 base::PostTaskAndReplyWithResult( 64 base::PostTaskAndReplyWithResult(
65 task_runner, 65 task_runner,
66 FROM_HERE, 66 FROM_HERE,
67 base::Bind(&BlockingCopyToFile, base::Passed(&source), destination), 67 base::Bind(&BlockingCopyToFile, base::Passed(&source), destination),
68 callback); 68 callback);
69 } 69 }
70 70
71 } // namespace common 71 } // namespace common
72 } // namespace mojo 72 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/bindings/js/core.cc ('k') | mojo/common/handle_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698