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

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

Issue 926753002: Improve DartLoader error handling. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove saw_error Created 5 years, 10 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 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_drainer.h" 5 #include "mojo/common/data_pipe_drainer.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 7
8 namespace mojo { 8 namespace mojo {
9 namespace common { 9 namespace common {
10 10
(...skipping 16 matching lines...) Expand all
27 &buffer, &num_bytes, MOJO_READ_DATA_FLAG_NONE); 27 &buffer, &num_bytes, MOJO_READ_DATA_FLAG_NONE);
28 if (rv == MOJO_RESULT_OK) { 28 if (rv == MOJO_RESULT_OK) {
29 client_->OnDataAvailable(buffer, num_bytes); 29 client_->OnDataAvailable(buffer, num_bytes);
30 EndReadDataRaw(source_.get(), num_bytes); 30 EndReadDataRaw(source_.get(), num_bytes);
31 WaitForData(); 31 WaitForData();
32 } else if (rv == MOJO_RESULT_SHOULD_WAIT) { 32 } else if (rv == MOJO_RESULT_SHOULD_WAIT) {
33 WaitForData(); 33 WaitForData();
34 } else if (rv == MOJO_RESULT_FAILED_PRECONDITION) { 34 } else if (rv == MOJO_RESULT_FAILED_PRECONDITION) {
35 client_->OnDataComplete(); 35 client_->OnDataComplete();
36 } else { 36 } else {
37 DCHECK(false); 37 DCHECK(false) << "Unhandled MojoResult: " << rv;
38 } 38 }
39 } 39 }
40 40
41 void DataPipeDrainer::WaitForData() { 41 void DataPipeDrainer::WaitForData() {
42 handle_watcher_.Start(source_.get(), 42 handle_watcher_.Start(source_.get(),
43 MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, 43 MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE,
44 base::Bind(&DataPipeDrainer::WaitComplete, weak_factory_.GetWeakPtr())); 44 base::Bind(&DataPipeDrainer::WaitComplete, weak_factory_.GetWeakPtr()));
45 } 45 }
46 46
47 void DataPipeDrainer::WaitComplete(MojoResult result) { 47 void DataPipeDrainer::WaitComplete(MojoResult result) {
48 ReadData(); 48 ReadData();
49 } 49 }
50 50
51 } // namespace common 51 } // namespace common
52 } // namespace mojo 52 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/script/dart_loader.h » ('j') | sky/engine/core/script/dart_loader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698