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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/file_downloader.cc

Issue 10532147: Additional fixes for warning mismatch with scons. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | « no previous file | ppapi/native_client/src/trusted/plugin/nacl_subprocess.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "native_client/src/trusted/plugin/file_downloader.h" 5 #include "native_client/src/trusted/plugin/file_downloader.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string> 8 #include <string>
9 9
10 #include "native_client/src/include/portability_io.h" 10 #include "native_client/src/include/portability_io.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 void FileDownloader::URLBufferStartNotify(int32_t pp_error) { 295 void FileDownloader::URLBufferStartNotify(int32_t pp_error) {
296 PLUGIN_PRINTF(("FileDownloader::URLBufferStartNotify (pp_error=%" 296 PLUGIN_PRINTF(("FileDownloader::URLBufferStartNotify (pp_error=%"
297 NACL_PRId32")\n", pp_error)); 297 NACL_PRId32")\n", pp_error));
298 298
299 if (!InitialResponseIsValid(pp_error)) 299 if (!InitialResponseIsValid(pp_error))
300 return; 300 return;
301 // Finish streaming the body asynchronously providing a callback. 301 // Finish streaming the body asynchronously providing a callback.
302 pp::CompletionCallback onread_callback = 302 pp::CompletionCallback onread_callback =
303 callback_factory_.NewOptionalCallback(&FileDownloader::URLReadBodyNotify); 303 callback_factory_.NewOptionalCallback(&FileDownloader::URLReadBodyNotify);
304
305 int32_t temp_size = static_cast<int32_t>(temp_buffer_.size());
304 pp_error = url_loader_.ReadResponseBody(&temp_buffer_[0], 306 pp_error = url_loader_.ReadResponseBody(&temp_buffer_[0],
305 temp_buffer_.size(), 307 temp_size,
306 onread_callback); 308 onread_callback);
307 bool async_notify_ok = (pp_error == PP_OK_COMPLETIONPENDING); 309 bool async_notify_ok = (pp_error == PP_OK_COMPLETIONPENDING);
308 PLUGIN_PRINTF(("FileDownloader::URLBufferStartNotify (async_notify_ok=%d)\n", 310 PLUGIN_PRINTF(("FileDownloader::URLBufferStartNotify (async_notify_ok=%d)\n",
309 async_notify_ok)); 311 async_notify_ok));
310 if (!async_notify_ok) { 312 if (!async_notify_ok) {
311 onread_callback.Run(pp_error); 313 onread_callback.Run(pp_error);
312 } 314 }
313 } 315 }
314 316
315 void FileDownloader::URLReadBodyNotify(int32_t pp_error) { 317 void FileDownloader::URLReadBodyNotify(int32_t pp_error) {
(...skipping 12 matching lines...) Expand all
328 } else if (streaming_to_user()) { 330 } else if (streaming_to_user()) {
329 PLUGIN_PRINTF(("Running data_stream_callback, temp_buffer_=%p\n", 331 PLUGIN_PRINTF(("Running data_stream_callback, temp_buffer_=%p\n",
330 &temp_buffer_[0])); 332 &temp_buffer_[0]));
331 StreamCallback cb = data_stream_callback_source_->GetCallback(); 333 StreamCallback cb = data_stream_callback_source_->GetCallback();
332 *(cb.output()) = &temp_buffer_; 334 *(cb.output()) = &temp_buffer_;
333 cb.Run(pp_error); 335 cb.Run(pp_error);
334 } 336 }
335 pp::CompletionCallback onread_callback = 337 pp::CompletionCallback onread_callback =
336 callback_factory_.NewOptionalCallback( 338 callback_factory_.NewOptionalCallback(
337 &FileDownloader::URLReadBodyNotify); 339 &FileDownloader::URLReadBodyNotify);
340 int32_t temp_size = static_cast<int32_t>(temp_buffer_.size());
338 pp_error = url_loader_.ReadResponseBody(&temp_buffer_[0], 341 pp_error = url_loader_.ReadResponseBody(&temp_buffer_[0],
339 temp_buffer_.size(), 342 temp_size,
340 onread_callback); 343 onread_callback);
341 bool async_notify_ok = (pp_error == PP_OK_COMPLETIONPENDING); 344 bool async_notify_ok = (pp_error == PP_OK_COMPLETIONPENDING);
342 if (!async_notify_ok) { 345 if (!async_notify_ok) {
343 onread_callback.Run(pp_error); 346 onread_callback.Run(pp_error);
344 } 347 }
345 } 348 }
346 } 349 }
347 350
348 void FileDownloader::FileOpenNotify(int32_t pp_error) { 351 void FileDownloader::FileOpenNotify(int32_t pp_error) {
349 PLUGIN_PRINTF(("FileDownloader::FileOpenNotify (pp_error=%"NACL_PRId32")\n", 352 PLUGIN_PRINTF(("FileDownloader::FileOpenNotify (pp_error=%"NACL_PRId32")\n",
350 pp_error)); 353 pp_error));
351 file_open_notify_callback_.Run(pp_error); 354 file_open_notify_callback_.Run(pp_error);
352 } 355 }
353 356
354 bool FileDownloader::streaming_to_file() const { 357 bool FileDownloader::streaming_to_file() const {
355 return mode_ == DOWNLOAD_TO_FILE; 358 return mode_ == DOWNLOAD_TO_FILE;
356 } 359 }
357 360
358 bool FileDownloader::streaming_to_buffer() const { 361 bool FileDownloader::streaming_to_buffer() const {
359 return mode_ == DOWNLOAD_TO_BUFFER; 362 return mode_ == DOWNLOAD_TO_BUFFER;
360 } 363 }
361 364
362 bool FileDownloader::streaming_to_user() const { 365 bool FileDownloader::streaming_to_user() const {
363 return mode_ == DOWNLOAD_STREAM; 366 return mode_ == DOWNLOAD_STREAM;
364 } 367 }
365 368
366 } // namespace plugin 369 } // namespace plugin
OLDNEW
« no previous file with comments | « no previous file | ppapi/native_client/src/trusted/plugin/nacl_subprocess.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698