Last Comment Bug 543061 - Serialize nsID
: Serialize nsID
Status: RESOLVED FIXED
fixed-in-bs
:
Product: Core
Classification: Components
Component: IPC (show other bugs)
: unspecified
: All All
: -- enhancement (vote)
: mozilla7
Assigned To: Kyle Huey [:khuey] (khuey@mozilla.com)
:
Mentors:
Depends on:
Blocks: 441197
  Show dependency treegraph
 
Reported: 2010-01-29 11:08 PST by Kyle Huey [:khuey] (khuey@mozilla.com)
Modified: 2011-06-25 18:37 PDT (History)
2 users (show)
khuey: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (1.80 KB, patch)
2010-01-29 11:08 PST, Kyle Huey [:khuey] (khuey@mozilla.com)
cjones.bugs: review+
bent.mozilla: review+
Details | Diff | Splinter Review
Patch w/nits (1.90 KB, patch)
2010-02-20 14:28 PST, Kyle Huey [:khuey] (khuey@mozilla.com)
khuey: review+
Details | Diff | Splinter Review
Patch (2.02 KB, patch)
2010-05-05 11:06 PDT, Kyle Huey [:khuey] (khuey@mozilla.com)
khuey: review+
Details | Diff | Splinter Review

Description Kyle Huey [:khuey] (khuey@mozilla.com) 2010-01-29 11:08:56 PST
Created attachment 424275 [details] [diff] [review]
Patch

It would be nice to serialize nsID.
Comment 1 Kyle Huey [:khuey] (khuey@mozilla.com) 2010-01-29 11:14:53 PST
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 2 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2010-02-01 10:30:30 PST
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.
Comment 3 Ben Turner (not reading bugmail, use the needinfo flag!) 2010-02-20 14:09:49 PST
Comment on attachment 424275 [details] [diff] [review]
Patch

Yeah, r+ with cjones' comments addressed.
Comment 4 Kyle Huey [:khuey] (khuey@mozilla.com) 2010-02-20 14:28:50 PST
Created attachment 427977 [details] [diff] [review]
Patch w/nits

w/nits
Comment 5 Kyle Huey [:khuey] (khuey@mozilla.com) 2010-05-05 11:06:44 PDT
Created attachment 443670 [details] [diff] [review]
Patch

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.
Comment 6 Kyle Huey [:khuey] (khuey@mozilla.com) 2011-06-24 11:38:05 PDT
http://hg.mozilla.org/projects/build-system/rev/87c28ff05bad
Comment 7 Kyle Huey [:khuey] (khuey@mozilla.com) 2011-06-25 18:37:07 PDT
http://hg.mozilla.org/mozilla-central/rev/87c28ff05bad

Note You need to log in before you can comment on or make changes to this bug.