Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/indexed_db/indexed_db_backing_store.h" | 5 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" | 33 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" |
| 34 #include "content/browser/indexed_db/leveldb/leveldb_database.h" | 34 #include "content/browser/indexed_db/leveldb/leveldb_database.h" |
| 35 #include "content/browser/indexed_db/leveldb/leveldb_factory.h" | 35 #include "content/browser/indexed_db/leveldb/leveldb_factory.h" |
| 36 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" | 36 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" |
| 37 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" | 37 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" |
| 38 #include "content/common/indexed_db/indexed_db_key.h" | 38 #include "content/common/indexed_db/indexed_db_key.h" |
| 39 #include "content/common/indexed_db/indexed_db_key_path.h" | 39 #include "content/common/indexed_db/indexed_db_key_path.h" |
| 40 #include "content/common/indexed_db/indexed_db_key_range.h" | 40 #include "content/common/indexed_db/indexed_db_key_range.h" |
| 41 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
| 42 #include "net/base/load_flags.h" | 42 #include "net/base/load_flags.h" |
| 43 #include "net/traffic_annotation/network_traffic_annotation.h" | |
| 43 #include "net/url_request/url_request_context.h" | 44 #include "net/url_request/url_request_context.h" |
| 44 #include "storage/browser/blob/blob_data_handle.h" | 45 #include "storage/browser/blob/blob_data_handle.h" |
| 45 #include "storage/browser/fileapi/file_stream_writer.h" | 46 #include "storage/browser/fileapi/file_stream_writer.h" |
| 46 #include "storage/browser/fileapi/file_writer_delegate.h" | 47 #include "storage/browser/fileapi/file_writer_delegate.h" |
| 47 #include "storage/browser/fileapi/local_file_stream_writer.h" | 48 #include "storage/browser/fileapi/local_file_stream_writer.h" |
| 48 #include "storage/common/database/database_identifier.h" | 49 #include "storage/common/database/database_identifier.h" |
| 49 #include "storage/common/fileapi/file_system_mount_option.h" | 50 #include "storage/common/fileapi/file_system_mount_option.h" |
| 50 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 51 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
| 51 #include "third_party/leveldatabase/env_chromium.h" | 52 #include "third_party/leveldatabase/env_chromium.h" |
| 52 | 53 |
| (...skipping 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2550 storage::FileStreamWriter::CreateForLocalFile( | 2551 storage::FileStreamWriter::CreateForLocalFile( |
| 2551 task_runner_.get(), file_path, 0, | 2552 task_runner_.get(), file_path, 0, |
| 2552 storage::FileStreamWriter::CREATE_NEW_FILE)); | 2553 storage::FileStreamWriter::CREATE_NEW_FILE)); |
| 2553 std::unique_ptr<FileWriterDelegate> delegate( | 2554 std::unique_ptr<FileWriterDelegate> delegate( |
| 2554 base::MakeUnique<FileWriterDelegate>( | 2555 base::MakeUnique<FileWriterDelegate>( |
| 2555 std::move(writer), storage::FlushPolicy::FLUSH_ON_COMPLETION)); | 2556 std::move(writer), storage::FlushPolicy::FLUSH_ON_COMPLETION)); |
| 2556 | 2557 |
| 2557 DCHECK(blob_url.is_valid()); | 2558 DCHECK(blob_url.is_valid()); |
| 2558 net::URLRequestContext* request_context = | 2559 net::URLRequestContext* request_context = |
| 2559 request_context_getter->GetURLRequestContext(); | 2560 request_context_getter->GetURLRequestContext(); |
| 2561 net::NetworkTrafficAnnotationTag traffic_annotation = | |
| 2562 net::DefineNetworkTrafficAnnotation("persist_blob_to_indexed_db", R"( | |
| 2563 semantics { | |
| 2564 sender: "Indexed DB" | |
| 2565 description: | |
| 2566 "A web page's script has created a Blob (or File) object (either " | |
| 2567 "directly via constructors, or by using file upload to a form, or " | |
| 2568 "via a fetch()). The script has then made a request to store data " | |
| 2569 "including the Blob via the Indexed DB API. As part of committing " | |
| 2570 "the database transaction, the content of the Blob is being copied " | |
| 2571 "into a file in the database's directory." | |
| 2572 trigger: | |
| 2573 "The script has made a request to store data including a Blob via " | |
| 2574 "the Indexed DB API." | |
| 2575 data: | |
| 2576 "A Blob or File object referenced by script, either created " | |
| 2577 "directly via constructors, or by using file upload to a form, or " | |
| 2578 "drag/dop, or via a fetch() or other APIs that produce Blobs." | |
|
msramek
2017/05/09 11:54:09
typo: drop
Ramin Halavati
2017/05/09 11:57:15
Done.
| |
| 2579 destination: LOCAL | |
| 2580 } | |
| 2581 policy { | |
| 2582 cookies_allowed: false | |
| 2583 setting: "This feature cannot be stoped by settings." | |
|
msramek
2017/05/09 11:54:09
s/stoped/disabled/ ?
(also, "stoped" seems to onl
Ramin Halavati
2017/05/09 11:57:15
Done.
| |
| 2584 policy_exception_justification: "Not implemented." | |
| 2585 })"); | |
| 2560 std::unique_ptr<net::URLRequest> blob_request( | 2586 std::unique_ptr<net::URLRequest> blob_request( |
| 2561 request_context->CreateRequest(blob_url, net::DEFAULT_PRIORITY, | 2587 request_context->CreateRequest(blob_url, net::DEFAULT_PRIORITY, |
| 2562 delegate.get())); | 2588 delegate.get(), traffic_annotation));)); |
| 2563 blob_request->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | | 2589 blob_request->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
| 2564 net::LOAD_DO_NOT_SEND_COOKIES); | 2590 net::LOAD_DO_NOT_SEND_COOKIES); |
| 2565 | |
| 2566 this->file_path_ = file_path; | 2591 this->file_path_ = file_path; |
| 2567 this->last_modified_ = last_modified; | 2592 this->last_modified_ = last_modified; |
| 2568 | 2593 |
| 2569 delegate->Start(std::move(blob_request), | 2594 delegate->Start(std::move(blob_request), |
| 2570 base::Bind(&LocalWriteClosure::Run, this)); | 2595 base::Bind(&LocalWriteClosure::Run, this)); |
| 2571 chained_blob_writer_->set_delegate(std::move(delegate)); | 2596 chained_blob_writer_->set_delegate(std::move(delegate)); |
| 2572 } | 2597 } |
| 2573 | 2598 |
| 2574 private: | 2599 private: |
| 2575 virtual ~LocalWriteClosure() { | 2600 virtual ~LocalWriteClosure() { |
| (...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4462 | 4487 |
| 4463 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( | 4488 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( |
| 4464 const WriteDescriptor& other) = default; | 4489 const WriteDescriptor& other) = default; |
| 4465 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() = | 4490 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() = |
| 4466 default; | 4491 default; |
| 4467 IndexedDBBackingStore::Transaction::WriteDescriptor& | 4492 IndexedDBBackingStore::Transaction::WriteDescriptor& |
| 4468 IndexedDBBackingStore::Transaction::WriteDescriptor:: | 4493 IndexedDBBackingStore::Transaction::WriteDescriptor:: |
| 4469 operator=(const WriteDescriptor& other) = default; | 4494 operator=(const WriteDescriptor& other) = default; |
| 4470 | 4495 |
| 4471 } // namespace content | 4496 } // namespace content |
| OLD | NEW |