Closed Bug 543061 Opened 14 years ago Closed 13 years ago

Serialize nsID

Categories

(Core :: IPC, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla7

People

(Reporter: khuey, Assigned: khuey)

References

Details

(Whiteboard: fixed-in-bs)

Attachments

(1 file, 2 obsolete files)

Attached patch Patch (obsolete) — Splinter Review
It would be nice to serialize nsID.
Attachment #424275 - Flags: review?(jones.chris.g)
Attachment #424275 - Flags: review?(bent.mozilla)
Just to make the rationale for doing this slightly more clear, in Bug 441197 we're going to need to pass a nsID to child processes so that their audio gets combined with the parent process's in the Vista audio system.
Comment on attachment 424275 [details] [diff] [review]
Patch

>diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h
>--- a/ipc/glue/IPCMessageUtils.h
>+++ b/ipc/glue/IPCMessageUtils.h
>@@ -39,16 +39,17 @@
>+template<>
>+struct ParamTraits<nsID>
>+{
>+  typedef nsID paramType;
>+
>+  static void Write(Message* aMsg, const paramType& aParam)
>+  {
>+    WriteParam(aMsg, aParam.m0);
>+    WriteParam(aMsg, aParam.m1);
>+    WriteParam(aMsg, aParam.m2);
>+    for (int i = 0; i < 8; i++) {
>+      WriteParam(aMsg, aParam.m3[i]);
>+    }
>+  }
>+

Nit: |i < NS_ARRAY_LENGTH(aParam.m3)|.

>+  static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
>+  {
>+    if(!ReadParam(aMsg, aIter, &(aResult->m0)) ||
>+       !ReadParam(aMsg, aIter, &(aResult->m1)) ||
>+       !ReadParam(aMsg, aIter, &(aResult->m2)))
>+      return false;
>+
>+    for (int i = 0; i < 8; i++)
>+      if (!ReadParam(aMsg, aIter, &(aResult->m3[i])))
>+        return false;
>+
>+    return true;
>+  }
>+

|i < NS_ARRAY_LENGTH(aResult->m3)|.

>+  static void Log(const paramType& aParam, std::wstring* aLog)
>+  {
>+    aLog->append(L"{");
>+    aLog->append(StringPrintf(L"%8.8X-%4.4X-%4.4X-",
>+                              aParam.m0,
>+                              aParam.m1,
>+                              aParam.m2));
>+    for (int i = 0; i < 8; i++)
>+      aLog->append(StringPrintf(L"%2.2X", aParam.m3[i]));
>+    aLog->append(L"}");
>+  }
>+};
>+

Also here.
Attachment #424275 - Flags: review?(jones.chris.g) → review+
Comment on attachment 424275 [details] [diff] [review]
Patch

Yeah, r+ with cjones' comments addressed.
Attachment #424275 - Flags: review?(bent.mozilla) → review+
Attached patch Patch w/nits (obsolete) — Splinter Review
w/nits
Attachment #424275 - Attachment is obsolete: true
Attachment #427977 - Flags: review+
Attached patch PatchSplinter Review
Unbitrotting and carrying review forward.  I've got a patch for the bug I wrote this for so I'll probably check this in fairly soon.
Attachment #427977 - Attachment is obsolete: true
Attachment #443670 - Flags: review+
http://hg.mozilla.org/mozilla-central/rev/87c28ff05bad
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: