| 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 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 | 1319 |
| 1320 void DownloadNexeCompletion(const DownloadNexeRequest& request, | 1320 void DownloadNexeCompletion(const DownloadNexeRequest& request, |
| 1321 base::PlatformFile target_file, | 1321 base::PlatformFile target_file, |
| 1322 PP_FileHandle* out_handle, | 1322 PP_FileHandle* out_handle, |
| 1323 FileDownloader::Status status, | 1323 FileDownloader::Status status, |
| 1324 int http_status); | 1324 int http_status); |
| 1325 | 1325 |
| 1326 void DownloadNexe(PP_Instance instance, | 1326 void DownloadNexe(PP_Instance instance, |
| 1327 const char* url, | 1327 const char* url, |
| 1328 PP_FileHandle* out_handle, | 1328 PP_FileHandle* out_handle, |
| 1329 uint64_t* file_token_lo, |
| 1330 uint64_t* file_token_hi, |
| 1329 PP_CompletionCallback callback) { | 1331 PP_CompletionCallback callback) { |
| 1330 CHECK(url); | 1332 CHECK(url); |
| 1331 CHECK(out_handle); | 1333 CHECK(out_handle); |
| 1332 DownloadNexeRequest request; | 1334 DownloadNexeRequest request; |
| 1333 request.instance = instance; | 1335 request.instance = instance; |
| 1334 request.url = url; | 1336 request.url = url; |
| 1335 request.callback = callback; | 1337 request.callback = callback; |
| 1336 request.start_time = base::Time::Now(); | 1338 request.start_time = base::Time::Now(); |
| 1337 | 1339 |
| 1338 // Try the fast path for retrieving the file first. | 1340 // Try the fast path for retrieving the file first. |
| 1339 uint64_t file_token_lo = 0; | |
| 1340 uint64_t file_token_hi = 0; | |
| 1341 PP_FileHandle file_handle = OpenNaClExecutable(instance, | 1341 PP_FileHandle file_handle = OpenNaClExecutable(instance, |
| 1342 url, | 1342 url, |
| 1343 &file_token_lo, | 1343 file_token_lo, |
| 1344 &file_token_hi); | 1344 file_token_hi); |
| 1345 if (file_handle != PP_kInvalidFileHandle) { | 1345 if (file_handle != PP_kInvalidFileHandle) { |
| 1346 DownloadNexeCompletion(request, | 1346 DownloadNexeCompletion(request, |
| 1347 file_handle, | 1347 file_handle, |
| 1348 out_handle, | 1348 out_handle, |
| 1349 FileDownloader::SUCCESS, | 1349 FileDownloader::SUCCESS, |
| 1350 200); | 1350 200); |
| 1351 return; | 1351 return; |
| 1352 } | 1352 } |
| 1353 | 1353 |
| 1354 // The fast path didn't work, we'll fetch the file using URLLoader and write | 1354 // The fast path didn't work, we'll fetch the file using URLLoader and write |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 &DownloadNexe | 1477 &DownloadNexe |
| 1478 }; | 1478 }; |
| 1479 | 1479 |
| 1480 } // namespace | 1480 } // namespace |
| 1481 | 1481 |
| 1482 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1482 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1483 return &nacl_interface; | 1483 return &nacl_interface; |
| 1484 } | 1484 } |
| 1485 | 1485 |
| 1486 } // namespace nacl | 1486 } // namespace nacl |
| OLD | NEW |