Closed Bug 687755 Opened 9 years ago Closed 9 years ago

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

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

This is a spinoff bug to track landing the first (already reviewed) patch in bug 686049.
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
Closed: 9 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
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.