feat: promisify session.getBlobData() (#17303)
This commit is contained in:
parent
c082b3964c
commit
aa8b66aae1
8 changed files with 45 additions and 38 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "atom/common/promise_util.h"
|
||||
#include "base/callback.h"
|
||||
|
||||
namespace content {
|
||||
|
@ -35,23 +36,20 @@ namespace atom {
|
|||
// except Ctor are expected to be called on IO thread.
|
||||
class AtomBlobReader {
|
||||
public:
|
||||
using CompletionCallback = base::Callback<void(v8::Local<v8::Value>)>;
|
||||
|
||||
explicit AtomBlobReader(content::ChromeBlobStorageContext* blob_context);
|
||||
~AtomBlobReader();
|
||||
|
||||
void StartReading(const std::string& uuid,
|
||||
const AtomBlobReader::CompletionCallback& callback);
|
||||
void StartReading(const std::string& uuid, atom::util::Promise promise);
|
||||
|
||||
private:
|
||||
// A self-destroyed helper class to read the blob data.
|
||||
// Must be accessed on IO thread.
|
||||
class BlobReadHelper {
|
||||
public:
|
||||
using CompletionCallback = base::Callback<void(char*, int)>;
|
||||
using CompletionCallback = base::OnceCallback<void(char*, int)>;
|
||||
|
||||
BlobReadHelper(std::unique_ptr<storage::BlobReader> blob_reader,
|
||||
const BlobReadHelper::CompletionCallback& callback);
|
||||
BlobReadHelper::CompletionCallback callback);
|
||||
~BlobReadHelper();
|
||||
|
||||
void Read();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue