| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/renderer/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
| 6 | 6 |
| 7 #include <numeric> | 7 #include <numeric> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 | 1312 |
| 1313 void DownloadNexeCompletion(const DownloadNexeRequest& request, | 1313 void DownloadNexeCompletion(const DownloadNexeRequest& request, |
| 1314 base::PlatformFile target_file, | 1314 base::PlatformFile target_file, |
| 1315 PP_FileHandle* out_handle, | 1315 PP_FileHandle* out_handle, |
| 1316 FileDownloader::Status status, | 1316 FileDownloader::Status status, |
| 1317 int http_status); | 1317 int http_status); |
| 1318 | 1318 |
| 1319 void DownloadNexe(PP_Instance instance, | 1319 void DownloadNexe(PP_Instance instance, |
| 1320 const char* url, | 1320 const char* url, |
| 1321 PP_FileHandle* out_handle, | 1321 PP_FileHandle* out_handle, |
| 1322 uint64_t* file_token_lo, |
| 1323 uint64_t* file_token_hi, |
| 1322 PP_CompletionCallback callback) { | 1324 PP_CompletionCallback callback) { |
| 1323 CHECK(url); | 1325 CHECK(url); |
| 1324 CHECK(out_handle); | 1326 CHECK(out_handle); |
| 1325 DownloadNexeRequest request; | 1327 DownloadNexeRequest request; |
| 1326 request.instance = instance; | 1328 request.instance = instance; |
| 1327 request.url = url; | 1329 request.url = url; |
| 1328 request.callback = callback; | 1330 request.callback = callback; |
| 1329 request.start_time = base::Time::Now(); | 1331 request.start_time = base::Time::Now(); |
| 1330 | 1332 |
| 1331 // Try the fast path for retrieving the file first. | 1333 // Try the fast path for retrieving the file first. |
| 1332 uint64_t file_token_lo = 0; | |
| 1333 uint64_t file_token_hi = 0; | |
| 1334 PP_FileHandle file_handle = OpenNaClExecutable(instance, | 1334 PP_FileHandle file_handle = OpenNaClExecutable(instance, |
| 1335 url, | 1335 url, |
| 1336 &file_token_lo, | 1336 file_token_lo, |
| 1337 &file_token_hi); | 1337 file_token_hi); |
| 1338 if (file_handle != PP_kInvalidFileHandle) { | 1338 if (file_handle != PP_kInvalidFileHandle) { |
| 1339 DownloadNexeCompletion(request, | 1339 DownloadNexeCompletion(request, |
| 1340 file_handle, | 1340 file_handle, |
| 1341 out_handle, | 1341 out_handle, |
| 1342 FileDownloader::SUCCESS, | 1342 FileDownloader::SUCCESS, |
| 1343 200); | 1343 200); |
| 1344 return; | 1344 return; |
| 1345 } | 1345 } |
| 1346 | 1346 |
| 1347 // The fast path didn't work, we'll fetch the file using URLLoader and write | 1347 // The fast path didn't work, we'll fetch the file using URLLoader and write |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 &DownloadNexe | 1471 &DownloadNexe |
| 1472 }; | 1472 }; |
| 1473 | 1473 |
| 1474 } // namespace | 1474 } // namespace |
| 1475 | 1475 |
| 1476 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1476 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1477 return &nacl_interface; | 1477 return &nacl_interface; |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 } // namespace nacl | 1480 } // namespace nacl |
| OLD | NEW |