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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 546 } |
547 | 547 |
548 PP_FileHandle GetReadonlyPnaclFd(const char* url) { | 548 PP_FileHandle GetReadonlyPnaclFd(const char* url) { |
549 std::string filename = PnaclComponentURLToFilename(url); | 549 std::string filename = PnaclComponentURLToFilename(url); |
550 IPC::PlatformFileForTransit out_fd = IPC::InvalidPlatformFileForTransit(); | 550 IPC::PlatformFileForTransit out_fd = IPC::InvalidPlatformFileForTransit(); |
551 IPC::Sender* sender = content::RenderThread::Get(); | 551 IPC::Sender* sender = content::RenderThread::Get(); |
552 DCHECK(sender); | 552 DCHECK(sender); |
553 if (!sender->Send(new NaClHostMsg_GetReadonlyPnaclFD( | 553 if (!sender->Send(new NaClHostMsg_GetReadonlyPnaclFD( |
554 std::string(filename), | 554 std::string(filename), |
555 &out_fd))) { | 555 &out_fd))) { |
556 return base::kInvalidPlatformFileValue; | 556 return PP_kInvalidFileHandle; |
557 } | 557 } |
558 if (out_fd == IPC::InvalidPlatformFileForTransit()) { | 558 if (out_fd == IPC::InvalidPlatformFileForTransit()) { |
559 return base::kInvalidPlatformFileValue; | 559 return PP_kInvalidFileHandle; |
560 } | 560 } |
561 base::PlatformFile handle = | 561 return IPC::PlatformFileForTransitToPlatformFile(out_fd); |
562 IPC::PlatformFileForTransitToPlatformFile(out_fd); | |
563 return handle; | |
564 } | 562 } |
565 | 563 |
566 PP_FileHandle CreateTemporaryFile(PP_Instance instance) { | 564 PP_FileHandle CreateTemporaryFile(PP_Instance instance) { |
567 IPC::PlatformFileForTransit transit_fd = IPC::InvalidPlatformFileForTransit(); | 565 IPC::PlatformFileForTransit transit_fd = IPC::InvalidPlatformFileForTransit(); |
568 IPC::Sender* sender = content::RenderThread::Get(); | 566 IPC::Sender* sender = content::RenderThread::Get(); |
569 DCHECK(sender); | 567 DCHECK(sender); |
570 if (!sender->Send(new NaClHostMsg_NaClCreateTemporaryFile( | 568 if (!sender->Send(new NaClHostMsg_NaClCreateTemporaryFile( |
571 &transit_fd))) { | 569 &transit_fd))) { |
572 return base::kInvalidPlatformFileValue; | 570 return PP_kInvalidFileHandle; |
573 } | 571 } |
574 | 572 |
575 if (transit_fd == IPC::InvalidPlatformFileForTransit()) { | 573 if (transit_fd == IPC::InvalidPlatformFileForTransit()) { |
576 return base::kInvalidPlatformFileValue; | 574 return PP_kInvalidFileHandle; |
577 } | 575 } |
578 | 576 |
579 base::PlatformFile handle = IPC::PlatformFileForTransitToPlatformFile( | 577 return IPC::PlatformFileForTransitToPlatformFile(transit_fd); |
580 transit_fd); | |
581 return handle; | |
582 } | 578 } |
583 | 579 |
584 int32_t GetNumberOfProcessors() { | 580 int32_t GetNumberOfProcessors() { |
585 int32_t num_processors; | 581 int32_t num_processors; |
586 IPC::Sender* sender = content::RenderThread::Get(); | 582 IPC::Sender* sender = content::RenderThread::Get(); |
587 DCHECK(sender); | 583 DCHECK(sender); |
588 if(!sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors))) { | 584 if(!sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors))) { |
589 return 1; | 585 return 1; |
590 } | 586 } |
591 return num_processors; | 587 return num_processors; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 DCHECK(sender); | 689 DCHECK(sender); |
694 *nonce_lo = 0; | 690 *nonce_lo = 0; |
695 *nonce_hi = 0; | 691 *nonce_hi = 0; |
696 base::FilePath file_path; | 692 base::FilePath file_path; |
697 if (!sender->Send( | 693 if (!sender->Send( |
698 new NaClHostMsg_OpenNaClExecutable(GetRoutingID(instance), | 694 new NaClHostMsg_OpenNaClExecutable(GetRoutingID(instance), |
699 GURL(file_url), | 695 GURL(file_url), |
700 &out_fd, | 696 &out_fd, |
701 nonce_lo, | 697 nonce_lo, |
702 nonce_hi))) { | 698 nonce_hi))) { |
703 return base::kInvalidPlatformFileValue; | 699 return PP_kInvalidFileHandle; |
704 } | 700 } |
705 | 701 |
706 if (out_fd == IPC::InvalidPlatformFileForTransit()) { | 702 if (out_fd == IPC::InvalidPlatformFileForTransit()) |
707 return base::kInvalidPlatformFileValue; | 703 return PP_kInvalidFileHandle; |
708 } | |
709 | 704 |
710 base::PlatformFile handle = | 705 return IPC::PlatformFileForTransitToPlatformFile(out_fd); |
711 IPC::PlatformFileForTransitToPlatformFile(out_fd); | |
712 return handle; | |
713 } | 706 } |
714 | 707 |
715 void DispatchEvent(PP_Instance instance, | 708 void DispatchEvent(PP_Instance instance, |
716 PP_NaClEventType event_type, | 709 PP_NaClEventType event_type, |
717 const char *resource_url, | 710 const char *resource_url, |
718 PP_Bool length_is_computable, | 711 PP_Bool length_is_computable, |
719 uint64_t loaded_bytes, | 712 uint64_t loaded_bytes, |
720 uint64_t total_bytes) { | 713 uint64_t total_bytes) { |
721 ProgressEvent event(event_type, | 714 ProgressEvent event(event_type, |
722 resource_url, | 715 resource_url, |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 | 1113 |
1121 PP_Bool GetPNaClResourceInfo(PP_Instance instance, | 1114 PP_Bool GetPNaClResourceInfo(PP_Instance instance, |
1122 const char* filename, | 1115 const char* filename, |
1123 PP_Var* llc_tool_name, | 1116 PP_Var* llc_tool_name, |
1124 PP_Var* ld_tool_name) { | 1117 PP_Var* ld_tool_name) { |
1125 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 1118 NexeLoadManager* load_manager = GetNexeLoadManager(instance); |
1126 DCHECK(load_manager); | 1119 DCHECK(load_manager); |
1127 if (!load_manager) | 1120 if (!load_manager) |
1128 return PP_FALSE; | 1121 return PP_FALSE; |
1129 | 1122 |
1130 base::PlatformFile file = GetReadonlyPnaclFd(filename); | 1123 base::File file(GetReadonlyPnaclFd(filename)); |
1131 if (file == base::kInvalidPlatformFileValue) { | 1124 if (!file.IsValid()) { |
1132 load_manager->ReportLoadError( | 1125 load_manager->ReportLoadError( |
1133 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, | 1126 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, |
1134 "The Portable Native Client (pnacl) component is not " | 1127 "The Portable Native Client (pnacl) component is not " |
1135 "installed. Please consult chrome://components for more " | 1128 "installed. Please consult chrome://components for more " |
1136 "information."); | 1129 "information."); |
1137 return PP_FALSE; | 1130 return PP_FALSE; |
1138 } | 1131 } |
1139 | 1132 |
1140 base::PlatformFileInfo file_info; | 1133 base::File::Info file_info; |
1141 if (!GetPlatformFileInfo(file, &file_info)) { | 1134 if (!file.GetInfo(&file_info)) { |
1142 load_manager->ReportLoadError( | 1135 load_manager->ReportLoadError( |
1143 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, | 1136 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, |
1144 std::string("GetPNaClResourceInfo, GetFileInfo failed for: ") + | 1137 std::string("GetPNaClResourceInfo, GetFileInfo failed for: ") + |
1145 filename); | 1138 filename); |
1146 return PP_FALSE; | 1139 return PP_FALSE; |
1147 } | 1140 } |
1148 | 1141 |
1149 if (file_info.size > 1 << 20) { | 1142 if (file_info.size > 1 << 20) { |
1150 load_manager->ReportLoadError( | 1143 load_manager->ReportLoadError( |
1151 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, | 1144 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, |
1152 std::string("GetPNaClResourceInfo, file too large: ") + filename); | 1145 std::string("GetPNaClResourceInfo, file too large: ") + filename); |
1153 return PP_FALSE; | 1146 return PP_FALSE; |
1154 } | 1147 } |
1155 | 1148 |
1156 scoped_ptr<char[]> buffer(new char[file_info.size + 1]); | 1149 scoped_ptr<char[]> buffer(new char[file_info.size + 1]); |
1157 if (buffer.get() == NULL) { | 1150 if (buffer.get() == NULL) { |
1158 load_manager->ReportLoadError( | 1151 load_manager->ReportLoadError( |
1159 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, | 1152 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, |
1160 std::string("GetPNaClResourceInfo, couldn't allocate for: ") + | 1153 std::string("GetPNaClResourceInfo, couldn't allocate for: ") + |
1161 filename); | 1154 filename); |
1162 return PP_FALSE; | 1155 return PP_FALSE; |
1163 } | 1156 } |
1164 | 1157 |
1165 int rc = base::ReadPlatformFile(file, 0, buffer.get(), file_info.size); | 1158 int rc = file.Read(0, buffer.get(), file_info.size); |
1166 if (rc < 0) { | 1159 if (rc < 0) { |
1167 load_manager->ReportLoadError( | 1160 load_manager->ReportLoadError( |
1168 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, | 1161 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, |
1169 std::string("GetPNaClResourceInfo, reading failed for: ") + filename); | 1162 std::string("GetPNaClResourceInfo, reading failed for: ") + filename); |
1170 return PP_FALSE; | 1163 return PP_FALSE; |
1171 } | 1164 } |
1172 | 1165 |
1173 // Null-terminate the bytes we we read from the file. | 1166 // Null-terminate the bytes we we read from the file. |
1174 buffer.get()[rc] = 0; | 1167 buffer.get()[rc] = 0; |
1175 | 1168 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 last_event_ = now; | 1301 last_event_ = now; |
1309 } | 1302 } |
1310 } | 1303 } |
1311 | 1304 |
1312 private: | 1305 private: |
1313 PP_Instance instance_; | 1306 PP_Instance instance_; |
1314 base::Time last_event_; | 1307 base::Time last_event_; |
1315 }; | 1308 }; |
1316 | 1309 |
1317 void DownloadNexeCompletion(const DownloadNexeRequest& request, | 1310 void DownloadNexeCompletion(const DownloadNexeRequest& request, |
1318 base::PlatformFile target_file, | |
1319 PP_NaClFileInfo* out_file_info, | 1311 PP_NaClFileInfo* out_file_info, |
1320 FileDownloader::Status status, | 1312 FileDownloader::Status status, |
| 1313 base::File target_file, |
1321 int http_status); | 1314 int http_status); |
1322 | 1315 |
1323 void DownloadNexe(PP_Instance instance, | 1316 void DownloadNexe(PP_Instance instance, |
1324 const char* url, | 1317 const char* url, |
1325 PP_NaClFileInfo* out_file_info, | 1318 PP_NaClFileInfo* out_file_info, |
1326 PP_CompletionCallback callback) { | 1319 PP_CompletionCallback callback) { |
1327 CHECK(url); | 1320 CHECK(url); |
1328 CHECK(out_file_info); | 1321 CHECK(out_file_info); |
1329 DownloadNexeRequest request; | 1322 DownloadNexeRequest request; |
1330 request.instance = instance; | 1323 request.instance = instance; |
1331 request.url = url; | 1324 request.url = url; |
1332 request.callback = callback; | 1325 request.callback = callback; |
1333 request.start_time = base::Time::Now(); | 1326 request.start_time = base::Time::Now(); |
1334 | 1327 |
1335 // Try the fast path for retrieving the file first. | 1328 // Try the fast path for retrieving the file first. |
1336 PP_FileHandle handle = OpenNaClExecutable(instance, | 1329 PP_FileHandle handle = OpenNaClExecutable(instance, |
1337 url, | 1330 url, |
1338 &out_file_info->token_lo, | 1331 &out_file_info->token_lo, |
1339 &out_file_info->token_hi); | 1332 &out_file_info->token_hi); |
1340 if (handle != PP_kInvalidFileHandle) { | 1333 if (handle != PP_kInvalidFileHandle) { |
1341 DownloadNexeCompletion(request, | 1334 DownloadNexeCompletion(request, |
1342 handle, | |
1343 out_file_info, | 1335 out_file_info, |
1344 FileDownloader::SUCCESS, | 1336 FileDownloader::SUCCESS, |
| 1337 base::File(handle), |
1345 200); | 1338 200); |
1346 return; | 1339 return; |
1347 } | 1340 } |
1348 | 1341 |
1349 // The fast path didn't work, we'll fetch the file using URLLoader and write | 1342 // The fast path didn't work, we'll fetch the file using URLLoader and write |
1350 // it to local storage. | 1343 // it to local storage. |
1351 base::PlatformFile target_file = CreateTemporaryFile(instance); | 1344 base::File target_file(CreateTemporaryFile(instance)); |
1352 GURL gurl(url); | 1345 GURL gurl(url); |
1353 | 1346 |
1354 content::PepperPluginInstance* plugin_instance = | 1347 content::PepperPluginInstance* plugin_instance = |
1355 content::PepperPluginInstance::Get(instance); | 1348 content::PepperPluginInstance::Get(instance); |
1356 if (!plugin_instance) { | 1349 if (!plugin_instance) { |
1357 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 1350 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
1358 FROM_HERE, | 1351 FROM_HERE, |
1359 base::Bind(callback.func, callback.user_data, | 1352 base::Bind(callback.func, callback.user_data, |
1360 static_cast<int32_t>(PP_ERROR_FAILED))); | 1353 static_cast<int32_t>(PP_ERROR_FAILED))); |
1361 } | 1354 } |
1362 const blink::WebDocument& document = | 1355 const blink::WebDocument& document = |
1363 plugin_instance->GetContainer()->element().document(); | 1356 plugin_instance->GetContainer()->element().document(); |
1364 scoped_ptr<blink::WebURLLoader> url_loader( | 1357 scoped_ptr<blink::WebURLLoader> url_loader( |
1365 CreateWebURLLoader(document, gurl)); | 1358 CreateWebURLLoader(document, gurl)); |
1366 blink::WebURLRequest url_request = CreateWebURLRequest(document, gurl); | 1359 blink::WebURLRequest url_request = CreateWebURLRequest(document, gurl); |
1367 | 1360 |
1368 ProgressEventRateLimiter* tracker = new ProgressEventRateLimiter(instance); | 1361 ProgressEventRateLimiter* tracker = new ProgressEventRateLimiter(instance); |
1369 | 1362 |
1370 // FileDownloader deletes itself after invoking DownloadNexeCompletion. | 1363 // FileDownloader deletes itself after invoking DownloadNexeCompletion. |
1371 FileDownloader* file_downloader = new FileDownloader( | 1364 FileDownloader* file_downloader = new FileDownloader( |
1372 url_loader.Pass(), | 1365 url_loader.Pass(), |
1373 target_file, | 1366 target_file.Pass(), |
1374 base::Bind(&DownloadNexeCompletion, request, target_file, out_file_info), | 1367 base::Bind(&DownloadNexeCompletion, request, out_file_info), |
1375 base::Bind(&ProgressEventRateLimiter::ReportProgress, | 1368 base::Bind(&ProgressEventRateLimiter::ReportProgress, |
1376 base::Owned(tracker), url)); | 1369 base::Owned(tracker), url)); |
1377 file_downloader->Load(url_request); | 1370 file_downloader->Load(url_request); |
1378 } | 1371 } |
1379 | 1372 |
1380 void DownloadNexeCompletion(const DownloadNexeRequest& request, | 1373 void DownloadNexeCompletion(const DownloadNexeRequest& request, |
1381 base::PlatformFile target_file, | |
1382 PP_NaClFileInfo* out_file_info, | 1374 PP_NaClFileInfo* out_file_info, |
1383 FileDownloader::Status status, | 1375 FileDownloader::Status status, |
| 1376 base::File target_file, |
1384 int http_status) { | 1377 int http_status) { |
1385 int32_t pp_error = FileDownloaderToPepperError(status); | 1378 int32_t pp_error = FileDownloaderToPepperError(status); |
1386 if (pp_error == PP_OK) | |
1387 out_file_info->handle = target_file; | |
1388 | |
1389 int64_t bytes_read = -1; | 1379 int64_t bytes_read = -1; |
1390 if (pp_error == PP_OK && target_file != base::kInvalidPlatformFileValue) { | 1380 if (pp_error == PP_OK && target_file.IsValid()) { |
1391 base::PlatformFileInfo info; | 1381 base::File::Info info; |
1392 if (GetPlatformFileInfo(target_file, &info)) | 1382 if (target_file.GetInfo(&info)) |
1393 bytes_read = info.size; | 1383 bytes_read = info.size; |
1394 } | 1384 } |
1395 | 1385 |
1396 if (bytes_read == -1) { | 1386 if (bytes_read == -1) { |
1397 base::ClosePlatformFile(target_file); | 1387 target_file.Close(); |
1398 pp_error = PP_ERROR_FAILED; | 1388 pp_error = PP_ERROR_FAILED; |
1399 } | 1389 } |
1400 | 1390 |
1401 base::TimeDelta download_time = base::Time::Now() - request.start_time; | 1391 base::TimeDelta download_time = base::Time::Now() - request.start_time; |
1402 | 1392 |
1403 NexeLoadManager* load_manager = GetNexeLoadManager(request.instance); | 1393 NexeLoadManager* load_manager = GetNexeLoadManager(request.instance); |
1404 if (load_manager) { | 1394 if (load_manager) { |
1405 load_manager->NexeFileDidOpen(pp_error, | 1395 load_manager->NexeFileDidOpen(pp_error, |
1406 target_file, | 1396 target_file, |
1407 http_status, | 1397 http_status, |
1408 bytes_read, | 1398 bytes_read, |
1409 request.url, | 1399 request.url, |
1410 download_time); | 1400 download_time); |
1411 } | 1401 } |
1412 | 1402 |
| 1403 if (pp_error == PP_OK && target_file.IsValid()) |
| 1404 out_file_info->handle = target_file.TakePlatformFile(); |
| 1405 else |
| 1406 out_file_info->handle = PP_kInvalidFileHandle; |
| 1407 |
1413 request.callback.func(request.callback.user_data, pp_error); | 1408 request.callback.func(request.callback.user_data, pp_error); |
1414 } | 1409 } |
1415 | 1410 |
1416 void DownloadFileCompletion(base::PlatformFile file, | 1411 void DownloadFileCompletion(PP_NaClFileInfo* file_info, |
1417 PP_NaClFileInfo* file_info, | |
1418 PP_CompletionCallback callback, | 1412 PP_CompletionCallback callback, |
1419 FileDownloader::Status status, | 1413 FileDownloader::Status status, |
| 1414 base::File file, |
1420 int http_status) { | 1415 int http_status) { |
1421 int32_t pp_error = FileDownloaderToPepperError(status); | 1416 int32_t pp_error = FileDownloaderToPepperError(status); |
1422 if (pp_error == PP_OK) { | 1417 if (pp_error == PP_OK) { |
1423 file_info->handle = file; | 1418 file_info->handle = file.TakePlatformFile(); |
1424 file_info->token_lo = 0; | 1419 file_info->token_lo = 0; |
1425 file_info->token_hi = 0; | 1420 file_info->token_hi = 0; |
1426 } | 1421 } |
1427 callback.func(callback.user_data, pp_error); | 1422 callback.func(callback.user_data, pp_error); |
1428 } | 1423 } |
1429 | 1424 |
1430 void DownloadFile(PP_Instance instance, | 1425 void DownloadFile(PP_Instance instance, |
1431 const char* url, | 1426 const char* url, |
1432 struct PP_NaClFileInfo* file_info, | 1427 struct PP_NaClFileInfo* file_info, |
1433 struct PP_CompletionCallback callback) { | 1428 struct PP_CompletionCallback callback) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 file_info->token_hi = file_token_hi; | 1487 file_info->token_hi = file_token_hi; |
1493 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 1488 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
1494 FROM_HERE, | 1489 FROM_HERE, |
1495 base::Bind(callback.func, callback.user_data, | 1490 base::Bind(callback.func, callback.user_data, |
1496 static_cast<int32_t>(PP_OK))); | 1491 static_cast<int32_t>(PP_OK))); |
1497 return; | 1492 return; |
1498 } | 1493 } |
1499 | 1494 |
1500 // The fast path didn't work, we'll fetch the file using URLLoader and write | 1495 // The fast path didn't work, we'll fetch the file using URLLoader and write |
1501 // it to local storage. | 1496 // it to local storage. |
1502 base::PlatformFile target_file = CreateTemporaryFile(instance); | 1497 base::File target_file(CreateTemporaryFile(instance)); |
1503 GURL gurl(url); | 1498 GURL gurl(url); |
1504 | 1499 |
1505 content::PepperPluginInstance* plugin_instance = | 1500 content::PepperPluginInstance* plugin_instance = |
1506 content::PepperPluginInstance::Get(instance); | 1501 content::PepperPluginInstance::Get(instance); |
1507 if (!plugin_instance) { | 1502 if (!plugin_instance) { |
1508 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 1503 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
1509 FROM_HERE, | 1504 FROM_HERE, |
1510 base::Bind(callback.func, callback.user_data, | 1505 base::Bind(callback.func, callback.user_data, |
1511 static_cast<int32_t>(PP_ERROR_FAILED))); | 1506 static_cast<int32_t>(PP_ERROR_FAILED))); |
1512 } | 1507 } |
1513 const blink::WebDocument& document = | 1508 const blink::WebDocument& document = |
1514 plugin_instance->GetContainer()->element().document(); | 1509 plugin_instance->GetContainer()->element().document(); |
1515 scoped_ptr<blink::WebURLLoader> url_loader( | 1510 scoped_ptr<blink::WebURLLoader> url_loader( |
1516 CreateWebURLLoader(document, gurl)); | 1511 CreateWebURLLoader(document, gurl)); |
1517 blink::WebURLRequest url_request = CreateWebURLRequest(document, gurl); | 1512 blink::WebURLRequest url_request = CreateWebURLRequest(document, gurl); |
1518 | 1513 |
1519 ProgressEventRateLimiter* tracker = new ProgressEventRateLimiter(instance); | 1514 ProgressEventRateLimiter* tracker = new ProgressEventRateLimiter(instance); |
1520 | 1515 |
1521 // FileDownloader deletes itself after invoking DownloadNexeCompletion. | 1516 // FileDownloader deletes itself after invoking DownloadNexeCompletion. |
1522 FileDownloader* file_downloader = new FileDownloader( | 1517 FileDownloader* file_downloader = new FileDownloader( |
1523 url_loader.Pass(), | 1518 url_loader.Pass(), |
1524 target_file, | 1519 target_file.Pass(), |
1525 base::Bind(&DownloadFileCompletion, target_file, file_info, callback), | 1520 base::Bind(&DownloadFileCompletion, file_info, callback), |
1526 base::Bind(&ProgressEventRateLimiter::ReportProgress, | 1521 base::Bind(&ProgressEventRateLimiter::ReportProgress, |
1527 base::Owned(tracker), url)); | 1522 base::Owned(tracker), url)); |
1528 file_downloader->Load(url_request); | 1523 file_downloader->Load(url_request); |
1529 } | 1524 } |
1530 | 1525 |
1531 const PPB_NaCl_Private nacl_interface = { | 1526 const PPB_NaCl_Private nacl_interface = { |
1532 &LaunchSelLdr, | 1527 &LaunchSelLdr, |
1533 &StartPpapiProxy, | 1528 &StartPpapiProxy, |
1534 &UrandomFD, | 1529 &UrandomFD, |
1535 &Are3DInterfacesDisabled, | 1530 &Are3DInterfacesDisabled, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 &DownloadFile | 1566 &DownloadFile |
1572 }; | 1567 }; |
1573 | 1568 |
1574 } // namespace | 1569 } // namespace |
1575 | 1570 |
1576 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1571 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1577 return &nacl_interface; | 1572 return &nacl_interface; |
1578 } | 1573 } |
1579 | 1574 |
1580 } // namespace nacl | 1575 } // namespace nacl |
OLD | NEW |