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

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: apply comments 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
« no previous file with comments | « Source/modules/webdatabase/Database.cpp ('k') | Source/modules/webdatabase/SQLError.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webdatabase/SQLError.h
diff --git a/Source/modules/webdatabase/SQLError.h b/Source/modules/webdatabase/SQLError.h
index fe024b09ac6997039396393822529688d2ec430a..911fd3aee0071c51664024c2a119865c4233bd7e 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_data.code(); }
+ String message() const { return m_data.message(); }
+
enum SQLErrorCode {
UNKNOWN_ERR = 0,
DATABASE_ERR = 1,
@@ -62,13 +86,12 @@ public:
static const char versionErrorMessage[];
private:
- SQLError(unsigned code, const String& message) : m_code(code), m_message(message.isolatedCopy())
+ explicit SQLError(const SQLErrorData& data) : m_data(data)
{
ScriptWrappable::init(this);
}
- unsigned m_code;
- String m_message;
+ const SQLErrorData m_data;
};
}
« no previous file with comments | « Source/modules/webdatabase/Database.cpp ('k') | Source/modules/webdatabase/SQLError.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698