Closed
Bug 1186791
Opened 9 years ago
Closed 9 years ago
Replace nsBaseHashtable::EnumerateRead() calls in storage/ with iterators
Categories
(Toolkit :: Storage, defect)
Toolkit
Storage
Tracking
()
RESOLVED
FIXED
mozilla45
People
(Reporter: n.nethercote, Assigned: n.nethercote)
References
Details
Attachments
(3 files)
6.02 KB,
patch
|
mak
:
review+
|
Details | Diff | Splinter Review |
2.17 KB,
patch
|
mak
:
review+
|
Details | Diff | Splinter Review |
3.18 KB,
patch
|
mak
:
review+
|
Details | Diff | Splinter Review |
Because iterators are so much nicer than enumerate functions. There are three occurrences of EnumerateRead() in this directory. A note to the assignee: to preserve existing behaviour, you should probably use nsBaseHashtable::Iterator::UserData() rather than nsBaseHashtable::Iterator::Data(). (The latter should be used when replacing nsBaseHashtable::Enumerate()).
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8679783 -
Flags: review?(mak77)
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → n.nethercote
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8679784 -
Flags: review?(mak77)
Assignee | ||
Comment 3•9 years ago
|
||
Attachment #8679785 -
Flags: review?(mak77)
Comment 4•9 years ago
|
||
Comment on attachment 8679783 [details] [diff] [review] (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in storage/ with iterators Review of attachment 8679783 [details] [diff] [review]: ----------------------------------------------------------------- ::: storage/mozStorageBindingParams.cpp @@ +197,5 @@ > // hashtable. > if (!mNamedParameters.Count()) > return BindingParams::bind(aStatement); > > + nsCOMPtr<mozIStorageError> err = nullptr; afaik, there's no need to assign nullptr to nsCOMPtr, it should already be initialized to that, unless it changed in the last months @@ +226,5 @@ > + // We had an error while trying to bind. Now we need to create an error > + // object with the right message. Note that we special case > + // SQLITE_MISMATCH, but otherwise get the message from SQLite. > + const char *msg = "Could not covert nsIVariant to SQLite type."; > + if (rc != SQLITE_MISMATCH) nit: while here, please brace this if... @@ +229,5 @@ > + const char *msg = "Could not covert nsIVariant to SQLite type."; > + if (rc != SQLITE_MISMATCH) > + msg = ::sqlite3_errmsg(::sqlite3_db_handle(aStatement)); > + > + err = new Error(rc, msg); ...and then you can remove the newline before this.
Attachment #8679783 -
Flags: review?(mak77) → review+
Updated•9 years ago
|
Attachment #8679784 -
Flags: review?(mak77) → review+
Comment 5•9 years ago
|
||
Comment on attachment 8679785 [details] [diff] [review] (part 3) - Replace nsBaseHashtable::EnumerateRead() calls in storage/ with iterators Review of attachment 8679785 [details] [diff] [review]: ----------------------------------------------------------------- ::: storage/mozStorageConnection.cpp @@ +1317,5 @@ > + for (auto iter = mFunctions.Iter(); !iter.Done(); iter.Next()) { > + const nsACString &key = iter.Key(); > + Connection::FunctionInfo data = iter.UserData(); > + > + NS_PRECONDITION(data.type == Connection::FunctionInfo::SIMPLE || please change this to a MOZ_ASSERT, it would be a coding mistake. @@ +1324,5 @@ > + > + if (data.type == Connection::FunctionInfo::SIMPLE) { > + mozIStorageFunction *function = > + static_cast<mozIStorageFunction *>(data.function.get()); > + (void)aClone->CreateFunction(key, data.numArgs, function); while here, this should probably warn and not just swallow any error... could define a DebugOnly<rv> and warn something like "Failed to copy function '$key' to cloned connection". @@ +1328,5 @@ > + (void)aClone->CreateFunction(key, data.numArgs, function); > + } else { > + mozIStorageAggregateFunction *function = > + static_cast<mozIStorageAggregateFunction *>(data.function.get()); > + (void)aClone->CreateAggregateFunction(key, data.numArgs, function); ditto
Attachment #8679785 -
Flags: review?(mak77) → review+
Comment 6•9 years ago
|
||
Thanks for this cleanup!
Assignee | ||
Comment 7•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/582ecb12478ae567b439bb5aa01a1ac3b9551e61 Bug 1186791 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in storage/ with iterators. r=mak. https://hg.mozilla.org/integration/mozilla-inbound/rev/15aad0a5b3cb1695bacaf3e4ecb40339cb7a2a1c Bug 1186791 (part 2) - Replace nsBaseHashtable::EnumerateRead() calls in storage/ with iterators. r=mak. https://hg.mozilla.org/integration/mozilla-inbound/rev/234e629e87cc1761289130f85039bba64a6ea07e Bug 1186791 (part 3) - Replace nsBaseHashtable::EnumerateRead() calls in storage/ with iterators. r=mak.
Comment 8•9 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/582ecb12478a https://hg.mozilla.org/mozilla-central/rev/15aad0a5b3cb https://hg.mozilla.org/mozilla-central/rev/234e629e87cc
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox45:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Comment 9•9 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/582ecb12478a https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/15aad0a5b3cb https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/234e629e87cc
status-b2g-v2.5:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•