Bug 736686 - Part 1: Make dictionary initializers callable off main thread. r=khuey
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 24 Mar 2012 12:33:49 +0100
changeset 90237 120e179a4af7ffae3c7d5df25f95ad0dacbe52fe
parent 90236 081b574dbad3ea95b40a458e036eabc7ed7ee7d3
child 90238 6009d836249f540739c89417a50922648a870f53
push id7546
push userdgottwald@mozilla.com
push dateSat, 24 Mar 2012 11:34:16 +0000
treeherdermozilla-inbound@6009d836249f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs736686
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 736686 - Part 1: Make dictionary initializers callable off main thread. r=khuey
js/xpconnect/src/dictionary_helper_gen.py
--- a/js/xpconnect/src/dictionary_helper_gen.py
+++ b/js/xpconnect/src/dictionary_helper_gen.py
@@ -424,18 +424,21 @@ def write_cpp(iface, fd):
     
     fd.write("nsresult\n%s::Init(JSContext* aCx, const jsval* aVal)\n" % iface.name)
     fd.write("{\n"
              "  if (!aCx || !aVal) {\n"
              "    return NS_OK;\n"
              "  }\n"
              "  NS_ENSURE_STATE(aVal->isObject());\n\n"
              "  JSObject* obj = &aVal->toObject();\n"
-             "  nsCxPusher pusher;\n"
-             "  NS_ENSURE_STATE(pusher.Push(aCx, false));\n"
+             "  Maybe<nsCxPusher> pusher;\n"
+             "  if (NS_IsMainThread()) {\n"
+             "    pusher.construct();\n"
+             "    NS_ENSURE_STATE(pusher.ref().Push(aCx, false));\n"
+             "  }\n"
              "  JSAutoRequest ar(aCx);\n"
              "  JSAutoEnterCompartment ac;\n"
              "  NS_ENSURE_STATE(ac.enter(aCx, obj));\n")
 
     fd.write("  return %s_InitInternal(*this, aCx, obj);\n}\n\n" %
                  iface.name)