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 "ppapi/proxy/nacl_message_scanner.h" | 5 #include "ppapi/proxy/nacl_message_scanner.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 files_.erase(it); | 385 files_.erase(it); |
386 // If the plugin is under-reporting, rewrite the message with the | 386 // If the plugin is under-reporting, rewrite the message with the |
387 // trusted value. | 387 // trusted value. |
388 if (trusted_max_written_offset > file_growth.max_written_offset) { | 388 if (trusted_max_written_offset > file_growth.max_written_offset) { |
389 new_msg_ptr->reset( | 389 new_msg_ptr->reset( |
390 new PpapiHostMsg_ResourceCall( | 390 new PpapiHostMsg_ResourceCall( |
391 params, | 391 params, |
392 PpapiHostMsg_FileIO_Close( | 392 PpapiHostMsg_FileIO_Close( |
393 FileGrowth(trusted_max_written_offset, 0)))); | 393 FileGrowth(trusted_max_written_offset, 0)))); |
394 } | 394 } |
| 395 break; |
395 } | 396 } |
396 case PpapiHostMsg_FileIO_SetLength::ID: { | 397 case PpapiHostMsg_FileIO_SetLength::ID: { |
397 FileIOMap::iterator it = files_.find(params.pp_resource()); | 398 FileIOMap::iterator it = files_.find(params.pp_resource()); |
398 if (it == files_.end()) | 399 if (it == files_.end()) |
399 return; | 400 return; |
400 // Audit FileIO SetLength messages to make sure the plugin is within | 401 // Audit FileIO SetLength messages to make sure the plugin is within |
401 // the current quota reservation. In addition, deduct the file size | 402 // the current quota reservation. In addition, deduct the file size |
402 // increase from the quota reservation. | 403 // increase from the quota reservation. |
403 int64_t length = 0; | 404 int64_t length = 0; |
404 if (!UnpackMessage<PpapiHostMsg_FileIO_SetLength>( | 405 if (!UnpackMessage<PpapiHostMsg_FileIO_SetLength>( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 // Audit resource destroyed messages to release FileSystems. | 460 // Audit resource destroyed messages to release FileSystems. |
460 PP_Resource resource; | 461 PP_Resource resource; |
461 if (!UnpackMessage<PpapiHostMsg_ResourceDestroyed>( | 462 if (!UnpackMessage<PpapiHostMsg_ResourceDestroyed>( |
462 nested_msg, &resource)) | 463 nested_msg, &resource)) |
463 return; | 464 return; |
464 FileSystemMap::iterator fs_it = file_systems_.find(resource); | 465 FileSystemMap::iterator fs_it = file_systems_.find(resource); |
465 if (fs_it != file_systems_.end()) { | 466 if (fs_it != file_systems_.end()) { |
466 delete fs_it->second; | 467 delete fs_it->second; |
467 file_systems_.erase(fs_it); | 468 file_systems_.erase(fs_it); |
468 } | 469 } |
| 470 break; |
469 } | 471 } |
470 } | 472 } |
471 } | 473 } |
472 } | 474 } |
473 | 475 |
474 void NaClMessageScanner::RegisterSyncMessageForReply(const IPC::Message& msg) { | 476 void NaClMessageScanner::RegisterSyncMessageForReply(const IPC::Message& msg) { |
475 int msg_id = IPC::SyncMessage::GetMessageId(msg); | 477 int msg_id = IPC::SyncMessage::GetMessageId(msg); |
476 DCHECK(pending_sync_msgs_.find(msg_id) == pending_sync_msgs_.end()); | 478 DCHECK(pending_sync_msgs_.find(msg_id) == pending_sync_msgs_.end()); |
477 | 479 |
478 pending_sync_msgs_[msg_id] = msg.type(); | 480 pending_sync_msgs_[msg_id] = msg.type(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 fio_it->second->SetMaxWrittenOffset(offset_it->second); | 534 fio_it->second->SetMaxWrittenOffset(offset_it->second); |
533 } | 535 } |
534 } | 536 } |
535 break; | 537 break; |
536 } | 538 } |
537 } | 539 } |
538 } | 540 } |
539 | 541 |
540 } // namespace proxy | 542 } // namespace proxy |
541 } // namespace ppapi | 543 } // namespace ppapi |
OLD | NEW |