refactor: make util::Promise type safe when chaining in native (#19809)

* refactor: make util::Promise type safe when chaining in native

* fixup! refactor: make util::Promise type safe when chaining in native

* chore: remove spare brackets
This commit is contained in:
Samuel Attard 2019-08-22 17:03:28 -07:00 committed by GitHub
parent f7e3e1f97a
commit 6a3922d330
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 275 additions and 343 deletions

View file

@ -27,7 +27,9 @@ void FreeNodeBufferData(char* data, void* hint) {
delete[] data;
}
void RunPromiseInUI(util::Promise promise, char* blob_data, int size) {
void RunPromiseInUI(util::Promise<v8::Local<v8::Value>> promise,
char* blob_data,
int size) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
v8::Isolate* isolate = promise.isolate();
@ -52,13 +54,13 @@ AtomBlobReader::AtomBlobReader(content::ChromeBlobStorageContext* blob_context)
AtomBlobReader::~AtomBlobReader() {}
void AtomBlobReader::StartReading(const std::string& uuid,
util::Promise promise) {
util::Promise<v8::Local<v8::Value>> promise) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
auto blob_data_handle = blob_context_->context()->GetBlobDataFromUUID(uuid);
if (!blob_data_handle) {
util::Promise::RejectPromise(std::move(promise),
"Could not get blob data handle");
util::Promise<v8::Local<v8::Value>>::RejectPromise(
std::move(promise), "Could not get blob data handle");
return;
}