RESOLVED FIXED 143329
Use constants of sqlite3 directly for status of SQL result in webdatabase
https://bugs.webkit.org/show_bug.cgi?id=143329
Summary Use constants of sqlite3 directly for status of SQL result in webdatabase
Gyuyoung Kim
Reported 2015-04-01 22:49:06 PDT
In webdatabase, it has used constants vairables as well as using SQL constants directly. If SQL constants are changed, we should modify many files. Besides it causes to use if~else statement which consumes more cpu cycles compared to switch~case. This patch introduces SQLResultType eunm type, and use it. Additionally if~else statment is changed by switch~case.
Attachments
Patch (26.28 KB, patch)
2015-04-01 22:56 PDT, Gyuyoung Kim
no flags
Patch (26.34 KB, patch)
2015-04-01 23:27 PDT, Gyuyoung Kim
no flags
Patch (26.43 KB, patch)
2015-04-02 16:18 PDT, Gyuyoung Kim
no flags
Patch (29.43 KB, patch)
2015-04-03 06:23 PDT, Gyuyoung Kim
no flags
Archive of layout-test-results from ews107 for mac-mavericks-wk2 (558.32 KB, application/zip)
2015-04-03 07:33 PDT, Build Bot
no flags
Patch (29.46 KB, patch)
2015-04-03 08:23 PDT, Gyuyoung Kim
no flags
Patch (125.07 KB, patch)
2015-04-03 18:44 PDT, Gyuyoung Kim
no flags
Patch (124.92 KB, patch)
2015-04-03 20:19 PDT, Gyuyoung Kim
no flags
Gyuyoung Kim
Comment 1 2015-04-01 22:56:19 PDT
Gyuyoung Kim
Comment 2 2015-04-01 23:27:52 PDT
Gyuyoung Kim
Comment 3 2015-04-02 16:18:52 PDT
Gyuyoung Kim
Comment 4 2015-04-03 06:23:28 PDT
Build Bot
Comment 5 2015-04-03 07:33:39 PDT
Comment on attachment 250067 [details] Patch Attachment 250067 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/4584866775564288 New failing tests: fast/fixed-layout/fixed-layout.html
Build Bot
Comment 6 2015-04-03 07:33:42 PDT
Created attachment 250069 [details] Archive of layout-test-results from ews107 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Gyuyoung Kim
Comment 7 2015-04-03 08:22:14 PDT
(In reply to comment #5) > Comment on attachment 250067 [details] > Patch > > Attachment 250067 [details] did not pass mac-wk2-ews (mac-wk2): > Output: http://webkit-queues.appspot.com/results/4584866775564288 > > New failing tests: > fast/fixed-layout/fixed-layout.html Looks unrelated test failure.
Gyuyoung Kim
Comment 8 2015-04-03 08:23:42 PDT
Darin Adler
Comment 9 2015-04-03 13:35:19 PDT
Comment on attachment 250074 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=250074&action=review I don’t understand why we are defining our own enum. Why not use the SQLite3 constants directly? > Source/WebCore/platform/sql/SQLiteDatabase.h:48 > +typedef enum { In C++ preferred syntax is enum X { } rather than typedef enum { } X; Also, in new code we prefer to use enum class. So this should be: enum class SQLResult { Done = SQLITE_DONE, ... } Then the constants are named SQLResult::Done.
Gyuyoung Kim
Comment 10 2015-04-03 18:44:45 PDT
Gyuyoung Kim
Comment 11 2015-04-03 18:47:56 PDT
(In reply to comment #9) > Comment on attachment 250074 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=250074&action=review > > I don’t understand why we are defining our own enum. Why not use the SQLite3 > constants directly? As I wrote in ChangeLog, it can cause to modify many files if constants of SQLite3 are changed. However If you think to use the constants directly, I don't object to do it. Updated patch uses the constants directly. > > Source/WebCore/platform/sql/SQLiteDatabase.h:48 > > +typedef enum { > > In C++ preferred syntax is enum X { } rather than typedef enum { } X; > > Also, in new code we prefer to use enum class. So this should be: > > enum class SQLResult { > Done = SQLITE_DONE, > ... > } > > Then the constants are named SQLResult::Done. If I change name of type, I had to modify more files which have used existing own constants variables. However new patch just uses SQLite3 constatns directly.
Gyuyoung Kim
Comment 12 2015-04-03 20:19:20 PDT
Gyuyoung Kim
Comment 13 2015-04-04 20:07:02 PDT
Darin, I wonder what do you think about updated patch.
WebKit Commit Bot
Comment 14 2015-04-05 13:45:28 PDT
Comment on attachment 250117 [details] Patch Clearing flags on attachment: 250117 Committed r182365: <http://trac.webkit.org/changeset/182365>
WebKit Commit Bot
Comment 15 2015-04-05 13:45:33 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.