Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1571)

Unified Diff: Source/modules/webdatabase/SQLError.h

Issue 210833005: Oilpan: Prepare to move SQLError to oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/webdatabase/SQLError.h
diff --git a/Source/modules/webdatabase/SQLError.h b/Source/modules/webdatabase/SQLError.h
index fe024b09ac6997039396393822529688d2ec430a..39094705028c08e4034562d890847335dcc3af7c 100644
--- a/Source/modules/webdatabase/SQLError.h
+++ b/Source/modules/webdatabase/SQLError.h
@@ -35,17 +35,41 @@
namespace WebCore {
-class SQLError : public ThreadSafeRefCounted<SQLError>, public ScriptWrappable {
+class SQLErrorData {
public:
- static PassRefPtr<SQLError> create(unsigned code, const String& message) { return adoptRef(new SQLError(code, message)); }
- static PassRefPtr<SQLError> create(unsigned code, const char* message, int sqliteCode, const char* sqliteMessage)
+ static PassOwnPtr<SQLErrorData> create(unsigned code, const String& message)
+ {
+ return adoptPtr(new SQLErrorData(code, message));
+ }
+
+ static PassOwnPtr<SQLErrorData> create(unsigned code, const char* message, int sqliteCode, const char* sqliteMessage)
{
return create(code, String::format("%s (%d %s)", message, sqliteCode, sqliteMessage));
}
+ static PassOwnPtr<SQLErrorData> create(const SQLErrorData& data)
+ {
+ return create(data.code(), data.message());
+ }
+
unsigned code() const { return m_code; }
String message() const { return m_message.isolatedCopy(); }
+private:
+ SQLErrorData(unsigned code, const String& message) : m_code(code), m_message(message.isolatedCopy()) { }
+
+ unsigned m_code;
+ String m_message;
+};
+
+class SQLError : public ThreadSafeRefCountedWillBeGarbageCollectedFinalized<SQLError>, public ScriptWrappable {
+public:
+ static PassRefPtrWillBeRawPtr<SQLError> create(const SQLErrorData& data) { return adoptRefWillBeNoop(new SQLError(data)); }
+ void trace(Visitor*) { }
+
+ unsigned code() const { return m_code; }
+ String message() const { return m_message; }
+
enum SQLErrorCode {
UNKNOWN_ERR = 0,
DATABASE_ERR = 1,
@@ -62,7 +86,7 @@ public:
static const char versionErrorMessage[];
private:
- SQLError(unsigned code, const String& message) : m_code(code), m_message(message.isolatedCopy())
+ SQLError(const SQLErrorData& data) : m_code(data.code()), m_message(data.message())
haraken 2014/03/25 11:50:05 Add 'explicit'.
tkent 2014/03/25 22:07:13 Done.
{
ScriptWrappable::init(this);
}

Powered by Google App Engine
This is Rietveld 408576698