summaryrefslogtreecommitdiff
path: root/chromium/storage
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-07-14 17:41:05 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-08-04 12:37:36 +0000
commit399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (patch)
tree6b06b60ff365abef0e13b3503d593a0df48d20e8 /chromium/storage
parent7366110654eec46f21b6824f302356426f48cd74 (diff)
downloadqtwebengine-chromium-399c965b6064c440ddcf4015f5f8e9d131c7a0a6.tar.gz
BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1
Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/storage')
-rw-r--r--chromium/storage/browser/BUILD.gn8
-rw-r--r--chromium/storage/browser/blob/OWNERS1
-rw-r--r--chromium/storage/browser/blob/blob_data_builder.cc22
-rw-r--r--chromium/storage/browser/blob/blob_data_builder.h6
-rw-r--r--chromium/storage/browser/blob/blob_data_item.cc13
-rw-r--r--chromium/storage/browser/blob/blob_data_item.h7
-rw-r--r--chromium/storage/browser/blob/blob_reader.cc49
-rw-r--r--chromium/storage/browser/blob/blob_reader.h25
-rw-r--r--chromium/storage/browser/blob/blob_storage_context.cc5
-rw-r--r--chromium/storage/browser/blob/blob_url_request_job.cc23
-rw-r--r--chromium/storage/browser/blob/blob_url_request_job.h3
-rw-r--r--chromium/storage/browser/blob/scoped_file.cc2
-rw-r--r--chromium/storage/browser/database/database_quota_client.cc2
-rw-r--r--chromium/storage/browser/fileapi/async_file_util_adapter.cc2
-rw-r--r--chromium/storage/browser/fileapi/file_system_context.cc2
-rw-r--r--chromium/storage/browser/fileapi/file_system_operation_runner.cc2
-rw-r--r--chromium/storage/browser/fileapi/isolated_file_system_backend.cc2
-rw-r--r--chromium/storage/browser/fileapi/plugin_private_file_system_backend.cc2
-rw-r--r--chromium/storage/browser/fileapi/recursive_operation_delegate.cc2
-rw-r--r--chromium/storage/browser/quota/quota_manager.cc69
-rw-r--r--chromium/storage/browser/quota/quota_manager.h2
-rw-r--r--chromium/storage/browser/quota/quota_task.cc2
-rw-r--r--chromium/storage/common/blob_storage/OWNERS1
-rw-r--r--chromium/storage/common/database/database_connections.cc2
24 files changed, 211 insertions, 43 deletions
diff --git a/chromium/storage/browser/BUILD.gn b/chromium/storage/browser/BUILD.gn
index 68027c0854e..4a712dc7391 100644
--- a/chromium/storage/browser/BUILD.gn
+++ b/chromium/storage/browser/BUILD.gn
@@ -201,13 +201,6 @@ component("browser") {
"//third_party/sqlite",
"//url",
]
-
- # TODO(GYP) support chrome_multiple_dll
- #['chrome_multiple_dll!=1', {
- # 'dependencies': [
- # '<(DEPTH)/third_party/WebKit/public/blink.gyp:blink',
- # ],
- #}],
}
executable("dump_file_system") {
@@ -219,6 +212,7 @@ executable("dump_file_system") {
":browser",
"//base",
"//build/config/sanitizers:deps",
+ "//build/win:default_exe_manifest",
"//storage/common",
]
}
diff --git a/chromium/storage/browser/blob/OWNERS b/chromium/storage/browser/blob/OWNERS
index c7e8dcb8b5b..04a70ee3383 100644
--- a/chromium/storage/browser/blob/OWNERS
+++ b/chromium/storage/browser/blob/OWNERS
@@ -1 +1,2 @@
+dmurph@chromium.org
jianli@chromium.org
diff --git a/chromium/storage/browser/blob/blob_data_builder.cc b/chromium/storage/browser/blob/blob_data_builder.cc
index 6b6210653f8..1397cede297 100644
--- a/chromium/storage/browser/blob/blob_data_builder.cc
+++ b/chromium/storage/browser/blob/blob_data_builder.cc
@@ -18,6 +18,12 @@
namespace storage {
+namespace {
+
+const static int kInvalidDiskCacheSideStreamIndex = -1;
+
+} // namespace
+
const char BlobDataBuilder::kAppendFutureFileTemporaryFileName[] =
"kFakeFilenameToBeChangedByPopulateFutureFile";
@@ -184,7 +190,21 @@ void BlobDataBuilder::AppendDiskCacheEntry(
element->SetToDiskCacheEntryRange(
0U, disk_cache_entry->GetDataSize(disk_cache_stream_index));
items_.push_back(new BlobDataItem(std::move(element), data_handle,
- disk_cache_entry, disk_cache_stream_index));
+ disk_cache_entry, disk_cache_stream_index,
+ kInvalidDiskCacheSideStreamIndex));
+}
+
+void BlobDataBuilder::AppendDiskCacheEntryWithSideData(
+ const scoped_refptr<DataHandle>& data_handle,
+ disk_cache::Entry* disk_cache_entry,
+ int disk_cache_stream_index,
+ int disk_cache_side_stream_index) {
+ std::unique_ptr<DataElement> element(new DataElement());
+ element->SetToDiskCacheEntryRange(
+ 0U, disk_cache_entry->GetDataSize(disk_cache_stream_index));
+ items_.push_back(new BlobDataItem(std::move(element), data_handle,
+ disk_cache_entry, disk_cache_stream_index,
+ disk_cache_side_stream_index));
}
void BlobDataBuilder::Clear() {
diff --git a/chromium/storage/browser/blob/blob_data_builder.h b/chromium/storage/browser/blob/blob_data_builder.h
index 5600ca8eab8..f304f446555 100644
--- a/chromium/storage/browser/blob/blob_data_builder.h
+++ b/chromium/storage/browser/blob/blob_data_builder.h
@@ -106,6 +106,12 @@ class STORAGE_EXPORT BlobDataBuilder {
void AppendDiskCacheEntry(const scoped_refptr<DataHandle>& data_handle,
disk_cache::Entry* disk_cache_entry,
int disk_cache_stream_index);
+ // The content of the side data is accessible with BlobReader::ReadSideData().
+ void AppendDiskCacheEntryWithSideData(
+ const scoped_refptr<DataHandle>& data_handle,
+ disk_cache::Entry* disk_cache_entry,
+ int disk_cache_stream_index,
+ int disk_cache_side_stream_index);
void set_content_type(const std::string& content_type) {
content_type_ = content_type;
diff --git a/chromium/storage/browser/blob/blob_data_item.cc b/chromium/storage/browser/blob/blob_data_item.cc
index 0e44427eb57..030b0d0d620 100644
--- a/chromium/storage/browser/blob/blob_data_item.cc
+++ b/chromium/storage/browser/blob/blob_data_item.cc
@@ -15,23 +15,27 @@ BlobDataItem::DataHandle::~DataHandle() {
BlobDataItem::BlobDataItem(std::unique_ptr<DataElement> item)
: item_(std::move(item)),
disk_cache_entry_(nullptr),
- disk_cache_stream_index_(-1) {}
+ disk_cache_stream_index_(-1),
+ disk_cache_side_stream_index_(-1) {}
BlobDataItem::BlobDataItem(std::unique_ptr<DataElement> item,
const scoped_refptr<DataHandle>& data_handle)
: item_(std::move(item)),
data_handle_(data_handle),
disk_cache_entry_(nullptr),
- disk_cache_stream_index_(-1) {}
+ disk_cache_stream_index_(-1),
+ disk_cache_side_stream_index_(-1) {}
BlobDataItem::BlobDataItem(std::unique_ptr<DataElement> item,
const scoped_refptr<DataHandle>& data_handle,
disk_cache::Entry* entry,
- int disk_cache_stream_index)
+ int disk_cache_stream_index,
+ int disk_cache_side_stream_index)
: item_(std::move(item)),
data_handle_(data_handle),
disk_cache_entry_(entry),
- disk_cache_stream_index_(disk_cache_stream_index) {}
+ disk_cache_stream_index_(disk_cache_stream_index),
+ disk_cache_side_stream_index_(disk_cache_side_stream_index) {}
BlobDataItem::~BlobDataItem() {}
@@ -47,6 +51,7 @@ void PrintTo(const BlobDataItem& x, ::std::ostream* os) {
bool operator==(const BlobDataItem& a, const BlobDataItem& b) {
return a.disk_cache_entry() == b.disk_cache_entry() &&
a.disk_cache_stream_index() == b.disk_cache_stream_index() &&
+ a.disk_cache_side_stream_index() == b.disk_cache_side_stream_index() &&
a.data_element() == b.data_element();
}
diff --git a/chromium/storage/browser/blob/blob_data_item.h b/chromium/storage/browser/blob/blob_data_item.h
index 6212b7c541d..a711a4caf3b 100644
--- a/chromium/storage/browser/blob/blob_data_item.h
+++ b/chromium/storage/browser/blob/blob_data_item.h
@@ -59,6 +59,9 @@ class STORAGE_EXPORT BlobDataItem : public base::RefCounted<BlobDataItem> {
disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; }
int disk_cache_stream_index() const { return disk_cache_stream_index_; }
+ int disk_cache_side_stream_index() const {
+ return disk_cache_side_stream_index_;
+ }
private:
friend class BlobDataBuilder;
@@ -72,7 +75,8 @@ class STORAGE_EXPORT BlobDataItem : public base::RefCounted<BlobDataItem> {
BlobDataItem(std::unique_ptr<DataElement> item,
const scoped_refptr<DataHandle>& data_handle,
disk_cache::Entry* entry,
- int disk_cache_stream_index_);
+ int disk_cache_stream_index,
+ int disk_cache_side_stream_index);
virtual ~BlobDataItem();
std::unique_ptr<DataElement> item_;
@@ -82,6 +86,7 @@ class STORAGE_EXPORT BlobDataItem : public base::RefCounted<BlobDataItem> {
// instance for disk cache entries during the lifetime of this BlobDataItem.
disk_cache::Entry* disk_cache_entry_;
int disk_cache_stream_index_; // For TYPE_DISK_CACHE_ENTRY.
+ int disk_cache_side_stream_index_; // For TYPE_DISK_CACHE_ENTRY.
};
STORAGE_EXPORT bool operator==(const BlobDataItem& a, const BlobDataItem& b);
diff --git a/chromium/storage/browser/blob/blob_reader.cc b/chromium/storage/browser/blob/blob_reader.cc
index 3e8ade6a57f..2eafdbcc77e 100644
--- a/chromium/storage/browser/blob/blob_reader.cc
+++ b/chromium/storage/browser/blob/blob_reader.cc
@@ -95,6 +95,55 @@ BlobReader::Status BlobReader::CalculateSize(
return CalculateSizeImpl(done);
}
+bool BlobReader::has_side_data() const {
+ if (!blob_data_.get())
+ return false;
+ const auto& items = blob_data_->items();
+ if (items.size() != 1)
+ return false;
+ const BlobDataItem& item = *items.at(0);
+ if (item.type() != DataElement::TYPE_DISK_CACHE_ENTRY)
+ return false;
+ const int disk_cache_side_stream_index = item.disk_cache_side_stream_index();
+ if (disk_cache_side_stream_index < 0)
+ return false;
+ return item.disk_cache_entry()->GetDataSize(disk_cache_side_stream_index) > 0;
+}
+
+BlobReader::Status BlobReader::ReadSideData(const StatusCallback& done) {
+ if (!has_side_data())
+ return ReportError(net::ERR_FILE_NOT_FOUND);
+ const BlobDataItem* item = blob_data_->items()[0].get();
+ const int disk_cache_side_stream_index = item->disk_cache_side_stream_index();
+ const int side_data_size =
+ item->disk_cache_entry()->GetDataSize(disk_cache_side_stream_index);
+ side_data_ = new net::IOBufferWithSize(side_data_size);
+ net_error_ = net::OK;
+ const int result = item->disk_cache_entry()->ReadData(
+ disk_cache_side_stream_index, 0, side_data_.get(), side_data_size,
+ base::Bind(&BlobReader::DidReadDiskCacheEntrySideData,
+ weak_factory_.GetWeakPtr(), done, side_data_size));
+ if (result >= 0) {
+ DCHECK_EQ(side_data_size, result);
+ return Status::DONE;
+ }
+ if (result == net::ERR_IO_PENDING)
+ return Status::IO_PENDING;
+ return ReportError(result);
+}
+
+void BlobReader::DidReadDiskCacheEntrySideData(const StatusCallback& done,
+ int expected_size,
+ int result) {
+ if (result >= 0) {
+ DCHECK_EQ(expected_size, result);
+ done.Run(Status::DONE);
+ return;
+ }
+ side_data_ = nullptr;
+ done.Run(ReportError(result));
+}
+
BlobReader::Status BlobReader::SetReadRange(uint64_t offset, uint64_t length) {
if (!blob_handle_.get() || blob_handle_->IsBroken()) {
return ReportError(net::ERR_FILE_NOT_FOUND);
diff --git a/chromium/storage/browser/blob/blob_reader.h b/chromium/storage/browser/blob/blob_reader.h
index 57943832a5f..a3c7cfa10a5 100644
--- a/chromium/storage/browser/blob/blob_reader.h
+++ b/chromium/storage/browser/blob/blob_reader.h
@@ -31,6 +31,7 @@ class Time;
namespace net {
class DrainableIOBuffer;
class IOBuffer;
+class IOBufferWithSize;
}
namespace storage {
@@ -65,6 +66,7 @@ class STORAGE_EXPORT BlobReader {
const base::Time& expected_modification_time) = 0;
};
enum class Status { NET_ERROR, IO_PENDING, DONE };
+ typedef base::Callback<void(Status)> StatusCallback;
virtual ~BlobReader();
// This calculates the total size of the blob, and initializes the reading
@@ -77,6 +79,25 @@ class STORAGE_EXPORT BlobReader {
// total_size() value to query the blob size, as it's uint64_t.
Status CalculateSize(const net::CompletionCallback& done);
+ // Returns true when the blob has side data. CalculateSize must be called
+ // beforehand. Currently side data is supported only for single DiskCache
+ // entry blob. So it returns false when the blob has more than single data
+ // item. This side data is used to pass the V8 code cache which is stored
+ // as a side stream in the CacheStorage to the renderer. (crbug.com/581613)
+ bool has_side_data() const;
+
+ // Reads the side data of the blob. CalculateSize must be called beforehand.
+ // * If the side data is read immediately, returns Status::DONE.
+ // * If an error happens or the blob doesn't have side data, returns
+ // Status::NET_ERROR and the net error code is set.
+ // * If this function returns Status::IO_PENDING, the done callback will be
+ // called with Status::DONE or Status::NET_ERROR.
+ // Currently side data is supported only for single DiskCache entry blob.
+ Status ReadSideData(const StatusCallback& done);
+
+ // Returns the side data which has been already read with ReadSideData().
+ net::IOBufferWithSize* side_data() const { return side_data_.get(); }
+
// Used to set the read position.
// * This should be called after CalculateSize and before Read.
// * Range can only be set once.
@@ -159,6 +180,9 @@ class STORAGE_EXPORT BlobReader {
Status ReadDiskCacheEntryItem(const BlobDataItem& item, int bytes_to_read);
void DidReadDiskCacheEntry(int result);
void DidReadItem(int result);
+ void DidReadDiskCacheEntrySideData(const StatusCallback& done,
+ int expected_size,
+ int result);
int ComputeBytesToRead() const;
int BytesReadCompleted();
@@ -177,6 +201,7 @@ class STORAGE_EXPORT BlobReader {
std::unique_ptr<BlobDataSnapshot> blob_data_;
std::unique_ptr<FileStreamReaderProvider> file_stream_provider_;
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
+ scoped_refptr<net::IOBufferWithSize> side_data_;
int net_error_;
bool item_list_populated_ = false;
diff --git a/chromium/storage/browser/blob/blob_storage_context.cc b/chromium/storage/browser/blob/blob_storage_context.cc
index 5beb1a52eb4..6ce45e53f90 100644
--- a/chromium/storage/browser/blob/blob_storage_context.cc
+++ b/chromium/storage/browser/blob/blob_storage_context.cc
@@ -19,7 +19,7 @@
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "storage/browser/blob/blob_data_builder.h"
#include "storage/browser/blob/blob_data_handle.h"
@@ -439,7 +439,8 @@ bool BlobStorageContext::AppendBlob(
target_blob_uuid,
new BlobDataItem(std::move(element), item.data_handle_,
item.disk_cache_entry(),
- item.disk_cache_stream_index())));
+ item.disk_cache_stream_index(),
+ item.disk_cache_side_stream_index())));
} break;
case DataElement::TYPE_BYTES_DESCRIPTION:
case DataElement::TYPE_BLOB:
diff --git a/chromium/storage/browser/blob/blob_url_request_job.cc b/chromium/storage/browser/blob/blob_url_request_job.cc
index 58863d00355..bdaff148683 100644
--- a/chromium/storage/browser/blob/blob_url_request_job.cc
+++ b/chromium/storage/browser/blob/blob_url_request_job.cc
@@ -208,11 +208,30 @@ void BlobURLRequestJob::DidCalculateSize(int result) {
blob_reader_->SetReadRange(byte_range_.first_byte_position(), length);
net::HttpStatusCode status_code = net::HTTP_OK;
- if (byte_range_set_ && byte_range_.IsValid())
+ if (byte_range_set_ && byte_range_.IsValid()) {
status_code = net::HTTP_PARTIAL_CONTENT;
+ } else {
+ // TODO(horo): When the requester doesn't need the side data (ex:FileReader)
+ // we should skip reading the side data.
+ if (blob_reader_->has_side_data() &&
+ blob_reader_->ReadSideData(base::Bind(
+ &BlobURLRequestJob::DidReadMetadata, weak_factory_.GetWeakPtr())) ==
+ BlobReader::Status::IO_PENDING) {
+ return;
+ }
+ }
+
HeadersCompleted(status_code);
}
+void BlobURLRequestJob::DidReadMetadata(BlobReader::Status result) {
+ if (result != BlobReader::Status::DONE) {
+ NotifyFailure(blob_reader_->net_error());
+ return;
+ }
+ HeadersCompleted(net::HTTP_OK);
+}
+
void BlobURLRequestJob::DidReadRawData(int result) {
TRACE_EVENT_ASYNC_END1("Blob", "BlobRequest::ReadRawData", this, "uuid",
blob_handle_ ? blob_handle_->uuid() : "NotFound");
@@ -294,6 +313,8 @@ void BlobURLRequestJob::HeadersCompleted(net::HttpStatusCode status_code) {
response_info_.reset(new net::HttpResponseInfo());
response_info_->headers = headers;
+ if (blob_reader_)
+ response_info_->metadata = blob_reader_->side_data();
NotifyHeadersComplete();
}
diff --git a/chromium/storage/browser/blob/blob_url_request_job.h b/chromium/storage/browser/blob/blob_url_request_job.h
index 24621f5ac04..1dadbd4fd9b 100644
--- a/chromium/storage/browser/blob/blob_url_request_job.h
+++ b/chromium/storage/browser/blob/blob_url_request_job.h
@@ -16,6 +16,7 @@
#include "net/http/http_byte_range.h"
#include "net/http/http_status_code.h"
#include "net/url_request/url_request_job.h"
+#include "storage/browser/blob/blob_reader.h"
#include "storage/browser/storage_browser_export.h"
namespace base {
@@ -30,7 +31,6 @@ class IOBuffer;
namespace storage {
class BlobDataHandle;
-class BlobReader;
class FileStreamReader;
class FileSystemContext;
@@ -62,6 +62,7 @@ class STORAGE_EXPORT BlobURLRequestJob
// For preparing for read: get the size, apply the range and perform seek.
void DidStart();
void DidCalculateSize(int result);
+ void DidReadMetadata(BlobReader::Status result);
void DidReadRawData(int result);
void NotifyFailure(int);
diff --git a/chromium/storage/browser/blob/scoped_file.cc b/chromium/storage/browser/blob/scoped_file.cc
index b57e88208f9..4e35bcdccf6 100644
--- a/chromium/storage/browser/blob/scoped_file.cc
+++ b/chromium/storage/browser/blob/scoped_file.cc
@@ -9,7 +9,7 @@
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/task_runner.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
namespace storage {
diff --git a/chromium/storage/browser/database/database_quota_client.cc b/chromium/storage/browser/database/database_quota_client.cc
index d8ae590231f..f1b0c7c4cba 100644
--- a/chromium/storage/browser/database/database_quota_client.cc
+++ b/chromium/storage/browser/database/database_quota_client.cc
@@ -13,7 +13,7 @@
#include "base/bind_helpers.h"
#include "base/location.h"
#include "base/task_runner_util.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "net/base/net_errors.h"
#include "net/base/url_util.h"
#include "storage/browser/database/database_tracker.h"
diff --git a/chromium/storage/browser/fileapi/async_file_util_adapter.cc b/chromium/storage/browser/fileapi/async_file_util_adapter.cc
index 8797ab7f5e8..4262c83a639 100644
--- a/chromium/storage/browser/fileapi/async_file_util_adapter.cc
+++ b/chromium/storage/browser/fileapi/async_file_util_adapter.cc
@@ -15,7 +15,7 @@
#include "base/macros.h"
#include "base/sequenced_task_runner.h"
#include "base/task_runner_util.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "storage/browser/blob/shareable_file_reference.h"
#include "storage/browser/fileapi/file_system_context.h"
#include "storage/browser/fileapi/file_system_file_util.h"
diff --git a/chromium/storage/browser/fileapi/file_system_context.cc b/chromium/storage/browser/fileapi/file_system_context.cc
index 94f5ab2b18c..c689d174fc9 100644
--- a/chromium/storage/browser/fileapi/file_system_context.cc
+++ b/chromium/storage/browser/fileapi/file_system_context.cc
@@ -16,7 +16,7 @@
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/task_runner_util.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "net/url_request/url_request.h"
#include "storage/browser/fileapi/copy_or_move_file_validator.h"
#include "storage/browser/fileapi/external_mount_points.h"
diff --git a/chromium/storage/browser/fileapi/file_system_operation_runner.cc b/chromium/storage/browser/fileapi/file_system_operation_runner.cc
index 665d7f040de..a3612595fe4 100644
--- a/chromium/storage/browser/fileapi/file_system_operation_runner.cc
+++ b/chromium/storage/browser/fileapi/file_system_operation_runner.cc
@@ -13,7 +13,7 @@
#include "base/bind.h"
#include "base/macros.h"
#include "base/stl_util.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "net/url_request/url_request_context.h"
#include "storage/browser/blob/blob_url_request_job_factory.h"
#include "storage/browser/blob/shareable_file_reference.h"
diff --git a/chromium/storage/browser/fileapi/isolated_file_system_backend.cc b/chromium/storage/browser/fileapi/isolated_file_system_backend.cc
index 5295a506880..78518e9b32f 100644
--- a/chromium/storage/browser/fileapi/isolated_file_system_backend.cc
+++ b/chromium/storage/browser/fileapi/isolated_file_system_backend.cc
@@ -15,7 +15,7 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/sequenced_task_runner.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "storage/browser/fileapi/async_file_util_adapter.h"
#include "storage/browser/fileapi/copy_or_move_file_validator.h"
#include "storage/browser/fileapi/dragged_file_util.h"
diff --git a/chromium/storage/browser/fileapi/plugin_private_file_system_backend.cc b/chromium/storage/browser/fileapi/plugin_private_file_system_backend.cc
index 6fd65cf32fb..54b0e7f7ce2 100644
--- a/chromium/storage/browser/fileapi/plugin_private_file_system_backend.cc
+++ b/chromium/storage/browser/fileapi/plugin_private_file_system_backend.cc
@@ -13,7 +13,7 @@
#include "base/stl_util.h"
#include "base/synchronization/lock.h"
#include "base/task_runner_util.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "net/base/url_util.h"
#include "storage/browser/fileapi/async_file_util_adapter.h"
#include "storage/browser/fileapi/file_stream_reader.h"
diff --git a/chromium/storage/browser/fileapi/recursive_operation_delegate.cc b/chromium/storage/browser/fileapi/recursive_operation_delegate.cc
index 415953c69f5..5b11f4e6eaf 100644
--- a/chromium/storage/browser/fileapi/recursive_operation_delegate.cc
+++ b/chromium/storage/browser/fileapi/recursive_operation_delegate.cc
@@ -8,7 +8,7 @@
#include "base/bind.h"
#include "base/single_thread_task_runner.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "storage/browser/fileapi/file_system_context.h"
#include "storage/browser/fileapi/file_system_operation_runner.h"
diff --git a/chromium/storage/browser/quota/quota_manager.cc b/chromium/storage/browser/quota/quota_manager.cc
index 26e469a9264..ad23d41ec83 100644
--- a/chromium/storage/browser/quota/quota_manager.cc
+++ b/chromium/storage/browser/quota/quota_manager.cc
@@ -19,6 +19,7 @@
#include "base/files/file_util.h"
#include "base/macros.h"
#include "base/metrics/histogram.h"
+#include "base/numerics/safe_conversions.h"
#include "base/profiler/scoped_tracker.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
@@ -339,15 +340,15 @@ void DispatchUsageAndQuotaForWebApps(
// We assume we can expose the actual disk size for them and cap the quota by
// the available disk space.
if (is_unlimited || can_query_disk_size) {
- callback.Run(
- status, usage,
- CalculateQuotaWithDiskSpace(
- usage_and_quota.available_disk_space,
- usage, quota));
- return;
+ quota = CalculateQuotaWithDiskSpace(
+ usage_and_quota.available_disk_space,
+ usage, quota);
}
callback.Run(status, usage, quota);
+
+ if (type == kStorageTypeTemporary && !is_unlimited)
+ UMA_HISTOGRAM_MBYTES("Quota.QuotaForOrigin", quota);
}
} // namespace
@@ -1477,14 +1478,11 @@ void QuotaManager::DeleteOriginDataInternal(const GURL& origin,
}
void QuotaManager::ReportHistogram() {
+ DCHECK(!is_incognito_);
GetGlobalUsage(kStorageTypeTemporary,
base::Bind(
&QuotaManager::DidGetTemporaryGlobalUsageForHistogram,
weak_factory_.GetWeakPtr()));
- GetGlobalUsage(kStorageTypePersistent,
- base::Bind(
- &QuotaManager::DidGetPersistentGlobalUsageForHistogram,
- weak_factory_.GetWeakPtr()));
}
void QuotaManager::DidGetTemporaryGlobalUsageForHistogram(
@@ -1502,13 +1500,17 @@ void QuotaManager::DidGetTemporaryGlobalUsageForHistogram(
special_storage_policy_.get(),
&protected_origins,
&unlimited_origins);
-
UMA_HISTOGRAM_COUNTS("Quota.NumberOfTemporaryStorageOrigins",
num_origins);
UMA_HISTOGRAM_COUNTS("Quota.NumberOfProtectedTemporaryStorageOrigins",
protected_origins);
UMA_HISTOGRAM_COUNTS("Quota.NumberOfUnlimitedTemporaryStorageOrigins",
unlimited_origins);
+
+ GetGlobalUsage(kStorageTypePersistent,
+ base::Bind(
+ &QuotaManager::DidGetPersistentGlobalUsageForHistogram,
+ weak_factory_.GetWeakPtr()));
}
void QuotaManager::DidGetPersistentGlobalUsageForHistogram(
@@ -1526,13 +1528,46 @@ void QuotaManager::DidGetPersistentGlobalUsageForHistogram(
special_storage_policy_.get(),
&protected_origins,
&unlimited_origins);
-
UMA_HISTOGRAM_COUNTS("Quota.NumberOfPersistentStorageOrigins",
num_origins);
UMA_HISTOGRAM_COUNTS("Quota.NumberOfProtectedPersistentStorageOrigins",
protected_origins);
UMA_HISTOGRAM_COUNTS("Quota.NumberOfUnlimitedPersistentStorageOrigins",
unlimited_origins);
+
+ // We DumpOriginInfoTable last to ensure the trackers caches are loaded.
+ DumpOriginInfoTable(
+ base::Bind(&QuotaManager::DidDumpOriginInfoTableForHistogram,
+ weak_factory_.GetWeakPtr()));
+}
+
+void QuotaManager::DidDumpOriginInfoTableForHistogram(
+ const OriginInfoTableEntries& entries) {
+ using UsageMap = std::map<GURL, int64_t>;
+ UsageMap usage_map;
+ GetUsageTracker(kStorageTypeTemporary)->GetCachedOriginsUsage(&usage_map);
+ base::Time now = base::Time::Now();
+ for (const auto& info : entries) {
+ if (info.type != kStorageTypeTemporary)
+ continue;
+
+ // Ignore stale database entries. If there is no map entry, the origin's
+ // data has been deleted.
+ UsageMap::const_iterator found = usage_map.find(info.origin);
+ if (found == usage_map.end() || found->second == 0)
+ continue;
+
+ base::TimeDelta age = now - std::max(info.last_access_time,
+ info.last_modified_time);
+ UMA_HISTOGRAM_COUNTS_1000("Quota.AgeOfOriginInDays", age.InDays());
+
+ int64_t kilobytes = std::max(found->second / INT64_C(1024), INT64_C(1));
+ base::Histogram::FactoryGet(
+ "Quota.AgeOfDataInDays", 1, 1000, 50,
+ base::HistogramBase::kUmaTargetedHistogramFlag)->
+ AddCount(age.InDays(),
+ base::saturated_cast<int>(kilobytes));
+ }
}
std::set<GURL> QuotaManager::GetEvictionOriginExceptions(
@@ -1716,10 +1751,12 @@ void QuotaManager::DidInitialize(int64_t* temporary_quota_override,
temporary_quota_initialized_ = true;
DidDatabaseWork(success);
- histogram_timer_.Start(FROM_HERE,
- base::TimeDelta::FromMilliseconds(
- kReportHistogramInterval),
- this, &QuotaManager::ReportHistogram);
+ if (!is_incognito_) {
+ histogram_timer_.Start(FROM_HERE,
+ base::TimeDelta::FromMilliseconds(
+ kReportHistogramInterval),
+ this, &QuotaManager::ReportHistogram);
+ }
db_initialization_callbacks_.Run();
GetTemporaryGlobalQuota(
diff --git a/chromium/storage/browser/quota/quota_manager.h b/chromium/storage/browser/quota/quota_manager.h
index cd691db9491..a1ef11d2a55 100644
--- a/chromium/storage/browser/quota/quota_manager.h
+++ b/chromium/storage/browser/quota/quota_manager.h
@@ -397,6 +397,8 @@ class STORAGE_EXPORT QuotaManager
int64_t unlimited_usage);
void DidGetPersistentGlobalUsageForHistogram(int64_t usage,
int64_t unlimited_usage);
+ void DidDumpOriginInfoTableForHistogram(
+ const OriginInfoTableEntries& entries);
std::set<GURL> GetEvictionOriginExceptions(
const std::set<GURL>& extra_exceptions);
diff --git a/chromium/storage/browser/quota/quota_task.cc b/chromium/storage/browser/quota/quota_task.cc
index 55ade2b2bd1..2a21b48d3bd 100644
--- a/chromium/storage/browser/quota/quota_task.cc
+++ b/chromium/storage/browser/quota/quota_task.cc
@@ -10,7 +10,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
using base::TaskRunner;
diff --git a/chromium/storage/common/blob_storage/OWNERS b/chromium/storage/common/blob_storage/OWNERS
new file mode 100644
index 00000000000..471c08e8a01
--- /dev/null
+++ b/chromium/storage/common/blob_storage/OWNERS
@@ -0,0 +1 @@
+dmurph@chromium.org
diff --git a/chromium/storage/common/database/database_connections.cc b/chromium/storage/common/database/database_connections.cc
index aa82d1e5a4f..f6931d3942b 100644
--- a/chromium/storage/common/database/database_connections.cc
+++ b/chromium/storage/common/database/database_connections.cc
@@ -11,7 +11,7 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/synchronization/waitable_event.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
namespace storage {