| OLD | NEW |
| 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 "ppapi/native_client/src/trusted/plugin/file_downloader.h" | 5 #include "ppapi/native_client/src/trusted/plugin/file_downloader.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 uint64_t file_token_lo, uint64_t file_token_hi) { | 180 uint64_t file_token_lo, uint64_t file_token_hi) { |
| 181 PLUGIN_PRINTF(("FileDownloader::OpenFast (url=%s)\n", url.c_str())); | 181 PLUGIN_PRINTF(("FileDownloader::OpenFast (url=%s)\n", url.c_str())); |
| 182 | 182 |
| 183 file_info_.FreeResources(); | 183 file_info_.FreeResources(); |
| 184 CHECK(instance_ != NULL); | 184 CHECK(instance_ != NULL); |
| 185 status_code_ = NACL_HTTP_STATUS_OK; | 185 status_code_ = NACL_HTTP_STATUS_OK; |
| 186 url_ = url; | 186 url_ = url; |
| 187 mode_ = DOWNLOAD_NONE; | 187 mode_ = DOWNLOAD_NONE; |
| 188 if (file_handle != PP_kInvalidFileHandle) { | 188 if (file_handle != PP_kInvalidFileHandle) { |
| 189 NaClFileInfo tmp_info = NoFileInfo(); | 189 NaClFileInfo tmp_info = NoFileInfo(); |
| 190 tmp_info.desc = ConvertFileDescriptor(file_handle); | 190 tmp_info.desc = ConvertFileDescriptor(file_handle, true); |
| 191 tmp_info.file_token.lo = file_token_lo; | 191 tmp_info.file_token.lo = file_token_lo; |
| 192 tmp_info.file_token.hi = file_token_hi; | 192 tmp_info.file_token.hi = file_token_hi; |
| 193 file_info_.TakeOwnership(&tmp_info); | 193 file_info_.TakeOwnership(&tmp_info); |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 NaClFileInfo FileDownloader::GetFileInfo() { | 197 NaClFileInfo FileDownloader::GetFileInfo() { |
| 198 NaClFileInfo info_to_return = NoFileInfo(); | 198 NaClFileInfo info_to_return = NoFileInfo(); |
| 199 | 199 |
| 200 PLUGIN_PRINTF(("FileDownloader::GetFileInfo, this %p\n", this)); | 200 PLUGIN_PRINTF(("FileDownloader::GetFileInfo, this %p\n", this)); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 file_reader_.pp_resource(), cb.output(), cb.pp_completion_callback()); | 400 file_reader_.pp_resource(), cb.output(), cb.pp_completion_callback()); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void FileDownloader::GotFileHandleNotify(int32_t pp_error, | 403 void FileDownloader::GotFileHandleNotify(int32_t pp_error, |
| 404 PP_FileHandle handle) { | 404 PP_FileHandle handle) { |
| 405 PLUGIN_PRINTF(( | 405 PLUGIN_PRINTF(( |
| 406 "FileDownloader::GotFileHandleNotify (pp_error=%" NACL_PRId32 ")\n", | 406 "FileDownloader::GotFileHandleNotify (pp_error=%" NACL_PRId32 ")\n", |
| 407 pp_error)); | 407 pp_error)); |
| 408 if (pp_error == PP_OK) { | 408 if (pp_error == PP_OK) { |
| 409 NaClFileInfo tmp_info = NoFileInfo(); | 409 NaClFileInfo tmp_info = NoFileInfo(); |
| 410 tmp_info.desc = ConvertFileDescriptor(handle); | 410 tmp_info.desc = ConvertFileDescriptor(handle, false); |
| 411 file_info_.TakeOwnership(&tmp_info); | 411 file_info_.TakeOwnership(&tmp_info); |
| 412 } | 412 } |
| 413 | 413 |
| 414 stream_finish_callback_.RunAndClear(pp_error); | 414 stream_finish_callback_.RunAndClear(pp_error); |
| 415 } | 415 } |
| 416 | 416 |
| 417 } // namespace plugin | 417 } // namespace plugin |
| OLD | NEW |