chore: clean up promise resoution with helpers (#17268)

This commit is contained in:
Shelley Vohr 2019-03-13 14:30:21 -07:00 committed by GitHub
parent 3e5a98b5f4
commit d9234798d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 52 deletions

View file

@ -19,15 +19,6 @@
#include "native_mate/handle.h"
#include "net/url_request/url_request_context_getter.h"
namespace {
void OnGetFilePathToCompletedLog(const atom::util::CopyablePromise& promise,
const base::FilePath& file_path) {
promise.GetPromise().Resolve(file_path);
}
} // namespace
namespace atom {
namespace api {
@ -120,7 +111,8 @@ void NetLog::OnNewState(const base::DictionaryValue& state) {
// TODO(zcbenz): Remove the use of CopyablePromise when the
// GetFilePathToCompletedLog API accepts OnceCallback.
net_log_writer_->GetFilePathToCompletedLog(base::Bind(
&OnGetFilePathToCompletedLog, util::CopyablePromise(promise)));
util::CopyablePromise::ResolveCopyablePromise<const base::FilePath&>,
util::CopyablePromise(promise)));
}
stop_callback_queue_.clear();
}