The default bug view has changed. See this FAQ.

Make it easy to forward methods from the DOM storage wrapper to the right implementation class

RESOLVED FIXED in mozilla9

Status

()

Core
DOM
RESOLVED FIXED
6 years ago
4 years ago

People

(Reporter: bz, Assigned: bz)

Tracking

unspecified
mozilla9
x86
Mac OS X
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

This is a spinoff bug to track landing the first (already reviewed) patch in bug 686049.
Created attachment 561105 [details] [diff] [review]
Refactor some code to make it easier to add new nsDOMStorageDBWrapper methods that forward to the various storage implementations.
https://hg.mozilla.org/integration/mozilla-inbound/rev/30a5dfdf8aba
Flags: in-testsuite-
Target Milestone: --- → mozilla9
According bug 683316 comment 4, could we update this to also support methods that has |void| return type somehow?

Maybe:

+#define IMPL_FORWARDER(_return, _code)                                \
+  PR_BEGIN_MACRO                                                      \
+  if (aStorage->CanUseChromePersist())                                \
+    _return mChromePersistentDB._code;                                \
+  if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())  \
+    _return mPrivateBrowsingDB._code;                                 \
+  if (aStorage->SessionOnly())                                        \
+    _return mSessionOnlyDB._code;                                     \
+  _return mPersistentDB._code;                                        \
+  PR_END_MACRO
+

And then:

 nsresult
 nsDOMStorageDBWrapper::GetAllKeys(DOMStorageImpl* aStorage,
                                   nsTHashtable<nsSessionStorageEntry>* aKeys)
 {
   IMPL_FORWARDER(return, GetAllKeys(aStorage, aKeys));
 }

 void
 nsDOMStorageDBWrapper::Whatever(...)
 {
   IMPL_FORWARDER((void), Whatever(...));
 }
https://hg.mozilla.org/mozilla-central/rev/30a5dfdf8aba
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
I was assuming you'd add a macro for that in bug 683316.  I'd prefer a IMPL_FORWARDER_GUTS macro with two arguments and an IMPL_FORWARDER and IMPL_VOID_FORWARDER that invoke it the right way.
Component: DOM: Mozilla Extensions → DOM
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.