OLD | NEW |
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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/strings/string_tokenizer.h" | 7 #include "base/strings/string_tokenizer.h" |
8 #include "mojo/public/cpp/application/application.h" | 8 #include "mojo/public/cpp/application/application.h" |
9 #include "mojo/services/public/cpp/view_manager/node.h" | 9 #include "mojo/services/public/cpp/view_manager/node.h" |
10 #include "mojo/services/public/cpp/view_manager/types.h" | 10 #include "mojo/services/public/cpp/view_manager/types.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 uint32_t bytes_remaining = content_length; | 36 uint32_t bytes_remaining = content_length; |
37 uint32_t num_bytes = bytes_remaining; | 37 uint32_t num_bytes = bytes_remaining; |
38 while (bytes_remaining > 0) { | 38 while (bytes_remaining > 0) { |
39 MojoResult result = ReadDataRaw( | 39 MojoResult result = ReadDataRaw( |
40 response_body_stream.get(), | 40 response_body_stream.get(), |
41 buf, | 41 buf, |
42 &num_bytes, | 42 &num_bytes, |
43 MOJO_READ_DATA_FLAG_NONE); | 43 MOJO_READ_DATA_FLAG_NONE); |
44 if (result == MOJO_RESULT_SHOULD_WAIT) { | 44 if (result == MOJO_RESULT_SHOULD_WAIT) { |
45 Wait(response_body_stream.get(), | 45 Wait(response_body_stream.get(), |
46 MOJO_WAIT_FLAG_READABLE, | 46 MOJO_HANDLE_SIGNAL_READABLE, |
47 MOJO_DEADLINE_INDEFINITE); | 47 MOJO_DEADLINE_INDEFINITE); |
48 } else if (result == MOJO_RESULT_OK) { | 48 } else if (result == MOJO_RESULT_OK) { |
49 buf += num_bytes; | 49 buf += num_bytes; |
50 num_bytes = bytes_remaining -= num_bytes; | 50 num_bytes = bytes_remaining -= num_bytes; |
51 } else { | 51 } else { |
52 break; | 52 break; |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 SkBitmap bitmap; | 56 SkBitmap bitmap; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 | 129 |
130 } // namespace examples | 130 } // namespace examples |
131 | 131 |
132 // static | 132 // static |
133 Application* Application::Create() { | 133 Application* Application::Create() { |
134 return new examples::ImageViewer; | 134 return new examples::ImageViewer; |
135 } | 135 } |
136 | 136 |
137 } // namespace mojo | 137 } // namespace mojo |
OLD | NEW |