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

Side by Side Diff: mojo/examples/wget/wget.cc

Issue 414633003: Mojo: Set a default value for the --origin command line switch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: refactored Created 6 years, 5 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 | « no previous file | mojo/shell/mojo_url_resolver.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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "mojo/public/cpp/application/application_delegate.h" 7 #include "mojo/public/cpp/application/application_delegate.h"
8 #include "mojo/public/cpp/application/application_impl.h" 8 #include "mojo/public/cpp/application/application_impl.h"
9 #include "mojo/public/cpp/utility/run_loop.h" 9 #include "mojo/public/cpp/utility/run_loop.h"
10 #include "mojo/services/public/interfaces/network/network_service.mojom.h" 10 #include "mojo/services/public/interfaces/network/network_service.mojom.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 for (;;) { 44 for (;;) {
45 char buf[512]; 45 char buf[512];
46 uint32_t num_bytes = sizeof(buf); 46 uint32_t num_bytes = sizeof(buf);
47 MojoResult result = ReadDataRaw(body.get(), buf, &num_bytes, 47 MojoResult result = ReadDataRaw(body.get(), buf, &num_bytes,
48 MOJO_READ_DATA_FLAG_NONE); 48 MOJO_READ_DATA_FLAG_NONE);
49 if (result == MOJO_RESULT_SHOULD_WAIT) { 49 if (result == MOJO_RESULT_SHOULD_WAIT) {
50 Wait(body.get(), 50 Wait(body.get(),
51 MOJO_HANDLE_SIGNAL_READABLE, 51 MOJO_HANDLE_SIGNAL_READABLE,
52 MOJO_DEADLINE_INDEFINITE); 52 MOJO_DEADLINE_INDEFINITE);
53 } else if (result == MOJO_RESULT_OK) { 53 } else if (result == MOJO_RESULT_OK) {
54 if (fwrite(buf, num_bytes, 1, stdout) != num_bytes) { 54 if (fwrite(buf, num_bytes, 1, stdout) != 1) {
55 printf("\nUnexpected error writing to file\n"); 55 printf("\nUnexpected error writing to file\n");
56 break; 56 break;
57 } 57 }
58 } else { 58 } else {
59 break; 59 break;
60 } 60 }
61 } 61 }
62 62
63 printf("\n>>> EOF <<<\n"); 63 printf("\n>>> EOF <<<\n");
64 } 64 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 }; 101 };
102 102
103 } // namespace examples 103 } // namespace examples
104 104
105 // static 105 // static
106 ApplicationDelegate* ApplicationDelegate::Create() { 106 ApplicationDelegate* ApplicationDelegate::Create() {
107 return new examples::WGetApp(); 107 return new examples::WGetApp();
108 } 108 }
109 109
110 } // namespace mojo 110 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/shell/mojo_url_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698