Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: content/browser/indexed_db/indexed_db_dispatcher_host.cc

Issue 333533002: Check File snapshots and Blob byte counts when writing to IDB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/browser/indexed_db/indexed_db_dispatcher_host.h" 5 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 for (size_t i = 0; i < params.blob_or_file_info.size(); ++i) { 643 for (size_t i = 0; i < params.blob_or_file_info.size(); ++i) {
644 const IndexedDBMsg_BlobOrFileInfo& info = params.blob_or_file_info[i]; 644 const IndexedDBMsg_BlobOrFileInfo& info = params.blob_or_file_info[i];
645 if (info.is_file) { 645 if (info.is_file) {
646 base::FilePath path = base::FilePath::FromUTF16Unsafe(info.file_path); 646 base::FilePath path = base::FilePath::FromUTF16Unsafe(info.file_path);
647 if (!policy->CanReadFile(parent_->ipc_process_id_, path)) { 647 if (!policy->CanReadFile(parent_->ipc_process_id_, path)) {
648 parent_->BadMessageReceived(); 648 parent_->BadMessageReceived();
649 return; 649 return;
650 } 650 }
651 blob_info[i] = 651 blob_info[i] =
652 IndexedDBBlobInfo(info.uuid, path, info.file_name, info.mime_type); 652 IndexedDBBlobInfo(info.uuid, path, info.file_name, info.mime_type);
653 if (info.size != static_cast<uint64_t>(-1)) {
cmumford 2014/06/19 19:37:54 Just curious why IndexedDBMsg_BlobOrFileInfo.size
ericu 2014/06/19 21:00:04 IIRC it's a remnant of the WebKit API; we might wa
654 blob_info[i].set_last_modified(
655 base::Time::FromDoubleT(info.last_modified));
656 blob_info[i].set_size(info.size);
657 }
653 } else { 658 } else {
654 blob_info[i] = IndexedDBBlobInfo(info.uuid, info.mime_type, info.size); 659 blob_info[i] = IndexedDBBlobInfo(info.uuid, info.mime_type, info.size);
655 } 660 }
656 } 661 }
657 662
658 // TODO(alecflett): Avoid a copy here. 663 // TODO(alecflett): Avoid a copy here.
659 IndexedDBValue value; 664 IndexedDBValue value;
660 value.bits = params.value; 665 value.bits = params.value;
661 value.blob_info.swap(blob_info); 666 value.blob_info.swap(blob_info);
662 connection->database()->Put( 667 connection->database()->Put(
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 } 979 }
975 980
976 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( 981 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed(
977 int32 ipc_object_id) { 982 int32 ipc_object_id) {
978 DCHECK( 983 DCHECK(
979 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); 984 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
980 parent_->DestroyObject(&map_, ipc_object_id); 985 parent_->DestroyObject(&map_, ipc_object_id);
981 } 986 }
982 987
983 } // namespace content 988 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698