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

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

Issue 830593003: Update mojo sdk to rev 9fbbc4f0fef1187312316c0ed992342474e139f1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cherry-pick mojo 9d3b8dd17f12d20035a14737fdc38dd926890ff8 Created 5 years, 11 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 | « mojo/application/application_test_main_chromium.cc ('k') | mojo/common/message_pump_mojo.h » ('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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 13 matching lines...) Expand all
24 MojoResult result = BeginReadDataRaw( 24 MojoResult result = BeginReadDataRaw(
25 source.get(), &buffer, &num_bytes, MOJO_READ_DATA_FLAG_NONE); 25 source.get(), &buffer, &num_bytes, MOJO_READ_DATA_FLAG_NONE);
26 if (result == MOJO_RESULT_OK) { 26 if (result == MOJO_RESULT_OK) {
27 size_t bytes_written = write_bytes.Run(buffer, num_bytes); 27 size_t bytes_written = write_bytes.Run(buffer, num_bytes);
28 result = EndReadDataRaw(source.get(), num_bytes); 28 result = EndReadDataRaw(source.get(), num_bytes);
29 if (bytes_written < num_bytes || result != MOJO_RESULT_OK) 29 if (bytes_written < num_bytes || result != MOJO_RESULT_OK)
30 return false; 30 return false;
31 } else if (result == MOJO_RESULT_SHOULD_WAIT) { 31 } else if (result == MOJO_RESULT_SHOULD_WAIT) {
32 result = Wait(source.get(), 32 result = Wait(source.get(),
33 MOJO_HANDLE_SIGNAL_READABLE, 33 MOJO_HANDLE_SIGNAL_READABLE,
34 MOJO_DEADLINE_INDEFINITE); 34 MOJO_DEADLINE_INDEFINITE,
35 nullptr);
35 if (result != MOJO_RESULT_OK) { 36 if (result != MOJO_RESULT_OK) {
36 // If the producer handle was closed, then treat as EOF. 37 // If the producer handle was closed, then treat as EOF.
37 return result == MOJO_RESULT_FAILED_PRECONDITION; 38 return result == MOJO_RESULT_FAILED_PRECONDITION;
38 } 39 }
39 } else if (result == MOJO_RESULT_FAILED_PRECONDITION) { 40 } else if (result == MOJO_RESULT_FAILED_PRECONDITION) {
40 // If the producer handle was closed, then treat as EOF. 41 // If the producer handle was closed, then treat as EOF.
41 return true; 42 return true;
42 } else { 43 } else {
43 // Some other error occurred. 44 // Some other error occurred.
44 break; 45 break;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const base::Callback<void(bool)>& callback) { 86 const base::Callback<void(bool)>& callback) {
86 base::PostTaskAndReplyWithResult( 87 base::PostTaskAndReplyWithResult(
87 task_runner, 88 task_runner,
88 FROM_HERE, 89 FROM_HERE,
89 base::Bind(&BlockingCopyToFile, base::Passed(&source), destination), 90 base::Bind(&BlockingCopyToFile, base::Passed(&source), destination),
90 callback); 91 callback);
91 } 92 }
92 93
93 } // namespace common 94 } // namespace common
94 } // namespace mojo 95 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/application/application_test_main_chromium.cc ('k') | mojo/common/message_pump_mojo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698