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 21 matching lines...) Expand all Loading... | |
32 #include "content/browser/indexed_db/indexed_db_value.h" | 32 #include "content/browser/indexed_db/indexed_db_value.h" |
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/traffic_annotation/network_traffic_annotation.h" | |
42 #include "net/url_request/url_request_context.h" | 43 #include "net/url_request/url_request_context.h" |
43 #include "storage/browser/blob/blob_data_handle.h" | 44 #include "storage/browser/blob/blob_data_handle.h" |
44 #include "storage/browser/fileapi/file_stream_writer.h" | 45 #include "storage/browser/fileapi/file_stream_writer.h" |
45 #include "storage/browser/fileapi/file_writer_delegate.h" | 46 #include "storage/browser/fileapi/file_writer_delegate.h" |
46 #include "storage/browser/fileapi/local_file_stream_writer.h" | 47 #include "storage/browser/fileapi/local_file_stream_writer.h" |
47 #include "storage/common/database/database_identifier.h" | 48 #include "storage/common/database/database_identifier.h" |
48 #include "storage/common/fileapi/file_system_mount_option.h" | 49 #include "storage/common/fileapi/file_system_mount_option.h" |
49 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 50 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
50 #include "third_party/leveldatabase/env_chromium.h" | 51 #include "third_party/leveldatabase/env_chromium.h" |
51 | 52 |
(...skipping 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2549 storage::FileStreamWriter::CreateForLocalFile( | 2550 storage::FileStreamWriter::CreateForLocalFile( |
2550 task_runner_.get(), file_path, 0, | 2551 task_runner_.get(), file_path, 0, |
2551 storage::FileStreamWriter::CREATE_NEW_FILE)); | 2552 storage::FileStreamWriter::CREATE_NEW_FILE)); |
2552 std::unique_ptr<FileWriterDelegate> delegate( | 2553 std::unique_ptr<FileWriterDelegate> delegate( |
2553 base::MakeUnique<FileWriterDelegate>( | 2554 base::MakeUnique<FileWriterDelegate>( |
2554 std::move(writer), storage::FlushPolicy::FLUSH_ON_COMPLETION)); | 2555 std::move(writer), storage::FlushPolicy::FLUSH_ON_COMPLETION)); |
2555 | 2556 |
2556 DCHECK(blob_url.is_valid()); | 2557 DCHECK(blob_url.is_valid()); |
2557 net::URLRequestContext* request_context = | 2558 net::URLRequestContext* request_context = |
2558 request_context_getter->GetURLRequestContext(); | 2559 request_context_getter->GetURLRequestContext(); |
2560 net::NetworkTrafficAnnotationTag traffic_annotation = | |
jsbell
2017/05/03 15:51:56
The request is for a content of a local file ("blo
Ramin Halavati
2017/05/04 04:41:01
Thank you for clarification. As a presubmit checke
| |
2561 net::DefineNetworkTrafficAnnotation("...", R"( | |
jsbell
2017/05/04 15:53:16
persist_blob_to_indexeddb
Ramin Halavati
2017/05/05 08:43:21
Done.
| |
2562 semantics { | |
2563 sender: "..." | |
jsbell
2017/05/04 15:53:16
Indexed DB
Ramin Halavati
2017/05/05 08:43:22
Done.
| |
2564 description: "..." | |
jsbell
2017/05/04 15:53:16
A web page's script has created a Blob (or File) o
Ramin Halavati
2017/05/05 08:43:21
Done.
| |
2565 trigger: "..." | |
jsbell
2017/05/04 15:53:16
The script has then made a request to store data i
Ramin Halavati
2017/05/05 08:43:21
Done.
| |
2566 data: "..." | |
jsbell
2017/05/04 15:53:17
A Blob or File object referenced by script, either
Ramin Halavati
2017/05/05 08:43:21
Done.
| |
2567 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER/LOCAL | |
jsbell
2017/05/04 15:53:16
LOCAL
Ramin Halavati
2017/05/05 08:43:21
Done.
| |
2568 } | |
2569 policy { | |
2570 cookies_allowed: false/true | |
Ramin Halavati
2017/05/05 08:43:22
Cookies are enabled by default, it seems that you
jsbell
2017/05/05 18:23:50
Yes please!
Ramin Halavati
2017/05/08 09:51:04
Done, in CL https://codereview.chromium.org/286424
| |
2571 cookies_store: "..." | |
2572 setting: "..." | |
2573 chrome_policy { | |
2574 [POLICY_NAME] { | |
2575 policy_options {mode: MANDATORY/RECOMMENDED/UNSET} | |
2576 [POLICY_NAME]: ... //(value to disable it) | |
2577 } | |
2578 } | |
2579 policy_exception_justification: "..." | |
2580 })"); | |
2559 std::unique_ptr<net::URLRequest> blob_request( | 2581 std::unique_ptr<net::URLRequest> blob_request( |
2560 request_context->CreateRequest(blob_url, net::DEFAULT_PRIORITY, | 2582 request_context->CreateRequest(blob_url, net::DEFAULT_PRIORITY, |
2561 delegate.get())); | 2583 delegate.get(), traffic_annotation)); |
2562 | 2584 |
2563 this->file_path_ = file_path; | 2585 this->file_path_ = file_path; |
2564 this->last_modified_ = last_modified; | 2586 this->last_modified_ = last_modified; |
2565 | 2587 |
2566 delegate->Start(std::move(blob_request), | 2588 delegate->Start(std::move(blob_request), |
2567 base::Bind(&LocalWriteClosure::Run, this)); | 2589 base::Bind(&LocalWriteClosure::Run, this)); |
2568 chained_blob_writer_->set_delegate(std::move(delegate)); | 2590 chained_blob_writer_->set_delegate(std::move(delegate)); |
2569 } | 2591 } |
2570 | 2592 |
2571 private: | 2593 private: |
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4459 | 4481 |
4460 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( | 4482 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( |
4461 const WriteDescriptor& other) = default; | 4483 const WriteDescriptor& other) = default; |
4462 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() = | 4484 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() = |
4463 default; | 4485 default; |
4464 IndexedDBBackingStore::Transaction::WriteDescriptor& | 4486 IndexedDBBackingStore::Transaction::WriteDescriptor& |
4465 IndexedDBBackingStore::Transaction::WriteDescriptor:: | 4487 IndexedDBBackingStore::Transaction::WriteDescriptor:: |
4466 operator=(const WriteDescriptor& other) = default; | 4488 operator=(const WriteDescriptor& other) = default; |
4467 | 4489 |
4468 } // namespace content | 4490 } // namespace content |
OLD | NEW |