Commit e266bcd7 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Use DOMExceptionCode in blink::IDBDatabaseError

Migrate the class member |code_| from int32_t to blink::DOMExceptionCode.

Bug: 1022358
Change-Id: Ibc957290e1a8eeec719881280e7cf4cc1256b86e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899453Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Commit-Queue: Daniel Murphy <dmurph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713531}
parent 77d9d898
......@@ -30,18 +30,16 @@
#define THIRD_PARTY_BLINK_RENDERER_MODULES_INDEXEDDB_IDB_DATABASE_ERROR_H_
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
class IDBDatabaseError {
// The code refers to the DOMException error names table here:
// https://heycam.github.io/webidl/#idl-DOMException-error-names
// TODO(dmurph): Make |code| a DOMExceptionCode
public:
explicit IDBDatabaseError(int32_t code) : code_(code) {}
explicit IDBDatabaseError(DOMExceptionCode code) : code_(code) {}
IDBDatabaseError(int32_t code, String message)
IDBDatabaseError(DOMExceptionCode code, String message)
: code_(code), message_(std::move(message)) {}
IDBDatabaseError(const IDBDatabaseError& error) = default;
......@@ -50,11 +48,11 @@ class IDBDatabaseError {
IDBDatabaseError& operator=(const IDBDatabaseError& error) = default;
int32_t Code() const { return code_; }
DOMExceptionCode Code() const { return code_; }
const String& Message() const { return message_; }
private:
int32_t code_;
DOMExceptionCode code_;
String message_;
};
......
......@@ -11,6 +11,7 @@
#include "third_party/blink/renderer/modules/indexeddb/idb_observation.h"
#include "third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.h"
#include "third_party/blink/renderer/modules/indexeddb/web_idb_database_callbacks.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.h"
namespace blink {
......@@ -32,7 +33,9 @@ void IndexedDBDatabaseCallbacksImpl::VersionChange(int64_t old_version,
void IndexedDBDatabaseCallbacksImpl::Abort(int64_t transaction_id,
int32_t code,
const String& message) {
callbacks_->OnAbort(transaction_id, IDBDatabaseError(code, message));
callbacks_->OnAbort(
transaction_id,
IDBDatabaseError(static_cast<DOMExceptionCode>(code), message));
}
void IndexedDBDatabaseCallbacksImpl::Complete(int64_t transaction_id) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment