Closed Bug 1499534 Opened 7 years ago Closed 7 years ago

ThrottledEventQueue needs methods to pause and resume events

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: jimb, Assigned: jimb)

References

Details

Attachments

(2 files)

As described in bug 1426467, the JavaScript debugger needs to be able to pause the delivery of worker messages to debuggee content while it is stopped at a breakpoint, single-stepping, etc. One way to accomplish this is to segregate those runnables sent from workers to the main thread that run content JavaScript (MessageEventRunnable, ReportGenericErrorRunnable, etc.) into their own ThrottledEventQueue, and then pause delivery of events from that queue to the main queue. ThrottledEventQueue ('TEQ') is an especially nice place to address this, because its runnables are never directly enqueued with the main thread; rather, the TEQ enqueues an Executor runnable on the main thread, and that is what dequeues runnables from the TEQ and runs them. The Executor is thus in a position to check whether the TEQ has been paused. Comments in the patch (to be attached) describe the implementation in detail.
This was already reviewed and approved in bug 1426467.
Assignee: nobody → jimb
Blocks: 1426467
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ca4774548edb Add GTests for ThrottledEventQueue. r=froydnj
Backed out changeset ca4774548edb (bug 1499534) for build bustage on gtest Log: https://treeherder.mozilla.org/logviewer.html#?job_id=206254241&repo=autoland&lineNumber=12060 INFO - mozmake.EXE[4]: Leaving directory 'z:/build/build/src/obj-firefox/intl/build' 23:45:39 INFO - mozmake.EXE[4]: Entering directory 'z:/build/build/src/obj-firefox/security/sandbox' 23:45:39 INFO - mozmake.EXE[4]: Leaving directory 'z:/build/build/src/obj-firefox/security/sandbox' 23:45:39 INFO - mozmake.EXE[4]: Entering directory 'z:/build/build/src/obj-firefox/security/sandbox' 23:45:39 INFO - mozmake.EXE[4]: Leaving directory 'z:/build/build/src/obj-firefox/security/sandbox' 23:45:39 INFO - mozmake.EXE[4]: Entering directory 'z:/build/build/src/obj-firefox/xpcom/tests/gtest' 23:45:39 INFO - z:/build/build/src/sccache2/sccache.exe z:/build/build/src/vs2017_15.8.4/VC/bin/Hostx64/x86/cl.exe -FoUnified_cpp_xpcom_tests_gtest3.obj -c -Iz:/build/build/src/obj-firefox/dist/stl_wrappers -DDEBUG=1 -DWIN32_LEAN_AND_MEAN -D_WIN32 -DWIN32 -D_CRT_RAND_S -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -DOS_WIN=1 -D_UNICODE -DCHROMIUM_BUILD -DU_STATIC_IMPLEMENTATION -DUNICODE -D_WINDOWS -D_SECURE_ATL -DCOMPILER_MSVC -DSTATIC_EXPORTABLE_JS_API -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -Iz:/build/build/src/xpcom/tests/gtest -Iz:/build/build/src/obj-firefox/xpcom/tests/gtest -Iz:/build/build/src/xpcom/base -Iz:/build/build/src/obj-firefox/ipc/ipdl/_ipdlheaders -Iz:/build/build/src/ipc/chromium/src -Iz:/build/build/src/ipc/glue -Iz:/build/build/src/obj-firefox/dist/include -Iz:/build/build/src/obj-firefox/dist/include/nspr -Iz:/build/build/src/obj-firefox/dist/include/nss -MD -FI z:/build/build/src/obj-firefox/mozilla-config.h -DMOZILLA_CLIENT -utf-8 -TP -nologo -w15038 -wd5026 -wd5027 -Zc:sizedDealloc- -wd4091 -wd4577 -D_HAS_EXCEPTIONS=0 -W3 -Gy -Zc:inline -arch:SSE2 -Gw -wd4251 -wd4244 -wd4267 -wd4800 -wd4595 -wd4065 -we4553 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING -GR- -Z7 -O1 -Oi -Oy- -WX -deps.deps/Unified_cpp_xpcom_tests_gtest3.obj.pp z:/build/build/src/obj-firefox/xpcom/tests/gtest/Unified_cpp_xpcom_tests_gtest3.cpp 23:45:39 INFO - Unified_cpp_xpcom_tests_gtest3.cpp 23:45:39 INFO - z:/build/build/src/xpcom/tests/gtest/TestThrottledEventQueue.cpp(63): error C2695: 'TestThrottledEventQueue::RunnableQueue::Dispatch': overriding virtual function differs from 'nsIEventTarget::Dispatch' only by calling convention 23:45:39 INFO - z:\build\build\src\obj-firefox\dist\include\nsIEventTarget.h(60): note: see declaration of 'nsIEventTarget::Dispatch' 23:45:39 INFO - z:/build/build/src/xpcom/tests/gtest/TestThrottledEventQueue.cpp(70): error C2695: 'TestThrottledEventQueue::RunnableQueue::DispatchFromScript': overriding virtual function differs from 'nsIEventTarget::DispatchFromScript' only by calling convention 23:45:39 INFO - z:\build\build\src\obj-firefox\dist\include\nsIEventTarget.h(63): note: see declaration of 'nsIEventTarget::DispatchFromScript' 23:45:39 INFO - z:/build/build/src/xpcom/tests/gtest/TestThrottledEventQueue.cpp(87): error C2695: 'TestThrottledEventQueue::RunnableQueue::DelayedDispatch': overriding virtual function differs from 'nsIEventTarget::DelayedDispatch' only by calling convention 23:45:39 INFO - z:\build\build\src\obj-firefox\dist\include\nsIEventTarget.h(66): note: see declaration of 'nsIEventTarget::DelayedDispatch' 23:45:39 INFO - z:/build/build/src/config/rules.mk:1118: recipe for target 'Unified_cpp_xpcom_tests_gtest3.obj' failed 23:45:39 INFO - mozmake.EXE[4]: *** [Unified_cpp_xpcom_tests_gtest3.obj] Error 2 23:45:39 INFO - mozmake.EXE[4]: Leaving directory 'z:/build/build/src/obj-firefox/xpcom/tests/gtest' 23:45:39 INFO - z:/build/build/src/config/recurse.mk:74: recipe for target 'xpcom/tests/gtest/target' failed 23:45:39 INFO - mozmake.EXE[3]: *** [xpcom/tests/gtest/target] Error 2 23:45:39 INFO - mozmake.EXE[3]: *** Waiting for unfinished jobs.... 23:45:39 INFO - mozmake.EXE[4]: Entering directory 'z:/build/build/src/obj-firefox/security/sandbox' 23:45:39 INFO - z:/build/build/src/sccache2/sccache.exe z:/build/build/src/vs2017_15.8.4/VC/bin/Hostx64/x86/cl.exe -Fofilesystem_interception.obj -c -DDEBUG=1 -DUNICODE -D_UNICODE -DNS_NO_XPCOM -D_CRT_RAND_S -DCHROMIUM_SANDBOX_BUILD -DSANDBOX_EXPORTS -Iz:/build/build/src/security/sandbox -Iz:/build/build/src/obj-firefox/security/sandbox -Iz:/build/build/src/security/sandbox/chromium-shim -Iz:/build/build/src/security/sandbox/chromium -Iz:/build/build/src/nsprpub -Iz:/build/build/src/obj-firefox/dist/include -Iz:/build/build/src/obj-firefox/dist/include/nspr -Iz:/build/build/src/obj-firefox/dist/include/nss -MD -FI z:/build/build/src/obj-firefox/mozilla-config.h -DMOZILLA_CLIENT -utf-8 -TP -nologo -w15038 -wd5026 -wd5027 -Zc:sizedDealloc- -wd4091 -wd4577 -D_HAS_EXCEPTIONS=0 -W3 -Gy -Zc:inline -arch:SSE2 -Gw -wd4251 -wd4244 -wd4267 -wd4800 -wd4595 -wd4065 -we4553 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING -GR- -Z7 -O1 -Oi -Oy- -WX -wd4275 -wd4717 -wd4996 -wd4302 -wd4311 -wd4312 -deps.deps/filesystem_interception.obj.pp z:/build/build/src/security/sandbox/chromium/sandbox/win/src/filesystem_interception.cc 23:45:39 INFO - filesystem_interception.cc 23:45:39 INFO - mozmake.EXE[4]: Leaving directory 'z:/build/build/src/obj-firefox/security/sandbox' 23:45:39 INFO - mozmake.EXE[4]: Entering directory 'z:/build/build/src/obj-firefox/media/libvpx' 23:45:39 INFO - mozmake.EXE[4]: Leaving directory 'z:/build/build/src/obj-firefox/media/libvpx' 23:45:39 INFO - mozmake.EXE[4]: Entering directory 'z:/build/build/src/obj-firefox/config/external/icu/i18n' 23:45:39 INFO - z:/build/build/src/sccache2/sccache.exe z:/build/build/src/vs2017_15.8.4/VC/bin/Hostx64/x86/cl.exe -Fonumber_scientific.obj -c -DDEBUG=1 -DU_I18N_IMPLEMENTATION -DUCONFIG_NO_TRANSLITERATION -DUCONFIG_NO_REGULAR_EXPRESSIONS -DUCONFIG_NO_LEGACY_CONVERSION -DU_USING_ICU_NAMESPACE=0 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_CHARSET_IS_UTF8 -DU_HAVE_NL_LANGINFO_CODESET=0 -DU_DEBUG=1 -Iz:/build/build/src/config/external/icu/i18n -Iz:/build/build/src/obj-firefox/config/external/icu/i18n -Iz:/build/build/src/intl/icu/source/common -Iz:/build/build/src/obj-firefox/dist/include -Iz:/build/build/src/obj-firefox/dist/include/nspr -Iz:/build/build/src/obj-firefox/dist/include/nss -MD -FI z:/build/build/src/obj-firefox/mozilla-config.h -DMOZILLA_CLIENT -utf-8 -TP -nologo -w15038 -wd5026 -wd5027 -Zc:sizedDealloc- -wd4091 -wd4577 -D_HAS_EXCEPTIONS=0 -W3 -Gy -Zc:inline -arch:SSE2 -Gw -wd4251 -wd4244 -wd4267 -wd4800 -wd4595 -wd4065 -we4553 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING -GR -Z7 -O1 -Oi -Oy- -wd4005 -wd4333 -wd4996 -deps.deps/number_scientific.obj.pp z:/build/build/src/intl/icu/source/i18n/number_scientific.cpp 23:45:39 INFO - number_scientific.cpp Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=ca4774548edb6ce092a600e246865e6111cee3d5 Backout: https://hg.mozilla.org/integration/autoland/rev/adb07f2a1331142569039567d81f5168ada17198
Flags: needinfo?(jimb)
Bah, I'm sorry - I had a patch for this and forgot to fold it in.
Flags: needinfo?(jimb)
The problem was that the patch was missing NS_IMETHOD and NS_IMETHODIMP macros, which causes build failures on Windows only.
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4a1ac74c37a8 Add GTests for ThrottledEventQueue. r=froydnj
Keywords: leave-open
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dfa1eb1d036f Add Pause, Resume, and IsPaused methods to ThrottledEventQueue. r=froydnj
Keywords: leave-open
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: