Make reading blobs work through Blob mojo interface.
https://chromium-review.googlesource.com/c/chromium/src/+/773199
This commit is contained in:
parent
a1683eb4e8
commit
c9f20516ac
3 changed files with 5 additions and 13 deletions
|
@ -11,7 +11,6 @@
|
||||||
#include "storage/browser/blob/blob_data_handle.h"
|
#include "storage/browser/blob/blob_data_handle.h"
|
||||||
#include "storage/browser/blob/blob_reader.h"
|
#include "storage/browser/blob/blob_reader.h"
|
||||||
#include "storage/browser/blob/blob_storage_context.h"
|
#include "storage/browser/blob/blob_storage_context.h"
|
||||||
#include "storage/browser/fileapi/file_system_context.h"
|
|
||||||
|
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
|
|
||||||
|
@ -46,9 +45,8 @@ void RunCallbackInUI(const AtomBlobReader::CompletionCallback& callback,
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
AtomBlobReader::AtomBlobReader(content::ChromeBlobStorageContext* blob_context,
|
AtomBlobReader::AtomBlobReader(content::ChromeBlobStorageContext* blob_context)
|
||||||
storage::FileSystemContext* file_system_context)
|
: blob_context_(blob_context) {}
|
||||||
: blob_context_(blob_context), file_system_context_(file_system_context) {}
|
|
||||||
|
|
||||||
AtomBlobReader::~AtomBlobReader() {}
|
AtomBlobReader::~AtomBlobReader() {}
|
||||||
|
|
||||||
|
@ -65,7 +63,7 @@ void AtomBlobReader::StartReading(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto blob_reader = blob_data_handle->CreateReader(file_system_context_.get());
|
auto blob_reader = blob_data_handle->CreateReader();
|
||||||
BlobReadHelper* blob_read_helper =
|
BlobReadHelper* blob_read_helper =
|
||||||
new BlobReadHelper(std::move(blob_reader), callback);
|
new BlobReadHelper(std::move(blob_reader), callback);
|
||||||
blob_read_helper->Read();
|
blob_read_helper->Read();
|
||||||
|
|
|
@ -20,7 +20,6 @@ class IOBuffer;
|
||||||
namespace storage {
|
namespace storage {
|
||||||
class BlobDataHandle;
|
class BlobDataHandle;
|
||||||
class BlobReader;
|
class BlobReader;
|
||||||
class FileSystemContext;
|
|
||||||
} // namespace storage
|
} // namespace storage
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
|
@ -37,8 +36,7 @@ class AtomBlobReader {
|
||||||
public:
|
public:
|
||||||
using CompletionCallback = base::Callback<void(v8::Local<v8::Value>)>;
|
using CompletionCallback = base::Callback<void(v8::Local<v8::Value>)>;
|
||||||
|
|
||||||
AtomBlobReader(content::ChromeBlobStorageContext* blob_context,
|
explicit AtomBlobReader(content::ChromeBlobStorageContext* blob_context);
|
||||||
storage::FileSystemContext* file_system_context);
|
|
||||||
~AtomBlobReader();
|
~AtomBlobReader();
|
||||||
|
|
||||||
void StartReading(const std::string& uuid,
|
void StartReading(const std::string& uuid,
|
||||||
|
@ -69,7 +67,6 @@ class AtomBlobReader {
|
||||||
};
|
};
|
||||||
|
|
||||||
scoped_refptr<content::ChromeBlobStorageContext> blob_context_;
|
scoped_refptr<content::ChromeBlobStorageContext> blob_context_;
|
||||||
scoped_refptr<storage::FileSystemContext> file_system_context_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(AtomBlobReader);
|
DISALLOW_COPY_AND_ASSIGN(AtomBlobReader);
|
||||||
};
|
};
|
||||||
|
|
|
@ -224,10 +224,7 @@ AtomBlobReader* AtomBrowserContext::GetBlobReader() {
|
||||||
if (!blob_reader_.get()) {
|
if (!blob_reader_.get()) {
|
||||||
content::ChromeBlobStorageContext* blob_context =
|
content::ChromeBlobStorageContext* blob_context =
|
||||||
content::ChromeBlobStorageContext::GetFor(this);
|
content::ChromeBlobStorageContext::GetFor(this);
|
||||||
storage::FileSystemContext* file_system_context =
|
blob_reader_.reset(new AtomBlobReader(blob_context));
|
||||||
content::BrowserContext::GetStoragePartition(this, nullptr)
|
|
||||||
->GetFileSystemContext();
|
|
||||||
blob_reader_.reset(new AtomBlobReader(blob_context, file_system_context));
|
|
||||||
}
|
}
|
||||||
return blob_reader_.get();
|
return blob_reader_.get();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue