author | Kyle Huey <khuey@kylehuey.com> |
Thu, 30 Jun 2016 13:54:06 -0700 | |
changeset 303317 | 910670d0db654142cfe10287a904d6dbe341334b |
parent 303316 | 9cc90f29c6e80b01b2d1ae0ab29b0f682ad89c35 |
child 303318 | cbc7f109be8ccaa17a1840df4c22a191a1007b2c |
push id | 30386 |
push user | cbook@mozilla.com |
push date | Fri, 01 Jul 2016 09:17:55 +0000 |
treeherder | mozilla-central@fdcee57b4e4f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | froydnj |
bugs | 1283328 |
milestone | 50.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
|
dom/media/systemservices/CamerasChild.cpp | file | annotate | diff | comparison | revisions | |
dom/media/systemservices/CamerasParent.cpp | file | annotate | diff | comparison | revisions | |
dom/media/systemservices/CamerasUtils.cpp | file | annotate | diff | comparison | revisions | |
dom/media/systemservices/CamerasUtils.h | file | annotate | diff | comparison | revisions | |
dom/media/systemservices/moz.build | file | annotate | diff | comparison | revisions | |
dom/media/webrtc/MediaEngineWebRTC.cpp | file | annotate | diff | comparison | revisions | |
netwerk/base/Tickler.cpp | file | annotate | diff | comparison | revisions |
--- a/dom/media/systemservices/CamerasChild.cpp +++ b/dom/media/systemservices/CamerasChild.cpp @@ -1,16 +1,15 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set sw=2 ts=8 et ft=cpp : */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "CamerasChild.h" -#include "CamerasUtils.h" #include "webrtc/video_engine/include/vie_capture.h" #undef FF #include "mozilla/Assertions.h" #include "mozilla/ipc/BackgroundChild.h" #include "mozilla/ipc/PBackgroundChild.h" #include "mozilla/Logging.h" @@ -482,24 +481,24 @@ Shutdown(void) return; } child->ShutdownAll(); } class ShutdownRunnable : public Runnable { public: explicit - ShutdownRunnable(RefPtr<Runnable> aReplyEvent) + ShutdownRunnable(already_AddRefed<Runnable>&& aReplyEvent) : mReplyEvent(aReplyEvent) {}; NS_IMETHOD Run() override { LOG(("Closing BackgroundChild")); ipc::BackgroundChild::CloseForCurrentThread(); - NS_DispatchToMainThread(mReplyEvent); + NS_DispatchToMainThread(mReplyEvent.forget()); return NS_OK; } private: RefPtr<Runnable> mReplyEvent; }; @@ -539,20 +538,20 @@ CamerasChild::ShutdownParent() void CamerasChild::ShutdownChild() { // Called with CamerasSingleton::Mutex() held if (CamerasSingleton::Thread()) { LOG(("PBackground thread exists, dispatching close")); // Dispatch closing the IPC thread back to us when the // BackgroundChild is closed. - RefPtr<Runnable> event = - new ThreadDestructor(CamerasSingleton::Thread()); - RefPtr<ShutdownRunnable> runnable = new ShutdownRunnable(event); - CamerasSingleton::Thread()->Dispatch(runnable, NS_DISPATCH_NORMAL); + RefPtr<ShutdownRunnable> runnable = + new ShutdownRunnable(NewRunnableMethod(CamerasSingleton::Thread(), + &nsIThread::Shutdown)); + CamerasSingleton::Thread()->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL); } else { LOG(("Shutdown called without PBackground thread")); } LOG(("Erasing sCameras & thread refs (original thread)")); CamerasSingleton::Child() = nullptr; CamerasSingleton::Thread() = nullptr; }
--- a/dom/media/systemservices/CamerasParent.cpp +++ b/dom/media/systemservices/CamerasParent.cpp @@ -1,16 +1,15 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set sw=2 ts=8 et ft=cpp : */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "CamerasParent.h" -#include "CamerasUtils.h" #include "MediaEngine.h" #include "MediaUtils.h" #include "mozilla/Assertions.h" #include "mozilla/unused.h" #include "mozilla/Services.h" #include "mozilla/Logging.h" #include "mozilla/ipc/BackgroundParent.h"
deleted file mode 100644 --- a/dom/media/systemservices/CamerasUtils.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set sw=2 ts=8 et ft=cpp : */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/unused.h" -#include "nsThreadUtils.h" -#include "nsCOMPtr.h" -#include "mozilla/Assertions.h" -#include "mozilla/ipc/BackgroundChild.h" -#include "mozilla/ipc/PBackgroundChild.h" -#include "nsIIPCBackgroundChildCreateCallback.h" - -namespace mozilla { -namespace camera { - -} -}
deleted file mode 100644 --- a/dom/media/systemservices/CamerasUtils.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set sw=2 ts=8 et ft=cpp : */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_CameraUtils_h -#define mozilla_CameraUtils_h - -#include "nsThreadUtils.h" -#include "nsCOMPtr.h" -#include "mozilla/UniquePtr.h" - -#include "base/thread.h" - -namespace mozilla { -namespace camera { - -class ThreadDestructor : public Runnable -{ - DISALLOW_COPY_AND_ASSIGN(ThreadDestructor); - -public: - explicit ThreadDestructor(nsIThread* aThread) - : mThread(aThread) {} - - NS_IMETHOD Run() override - { - if (mThread) { - mThread->Shutdown(); - } - return NS_OK; - } - -private: - ~ThreadDestructor() {} - nsCOMPtr<nsIThread> mThread; -}; - -} -} - -#endif // mozilla_CameraUtils_h
--- a/dom/media/systemservices/moz.build +++ b/dom/media/systemservices/moz.build @@ -3,25 +3,23 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. if CONFIG['MOZ_WEBRTC']: EXPORTS += [ 'CamerasChild.h', 'CamerasParent.h', - 'CamerasUtils.h', 'LoadManager.h', 'LoadManagerFactory.h', 'LoadMonitor.h', ] UNIFIED_SOURCES += [ 'CamerasChild.cpp', 'CamerasParent.cpp', - 'CamerasUtils.cpp', 'LoadManager.cpp', 'LoadManagerFactory.cpp', 'LoadMonitor.cpp', 'ShmemPool.cpp', ] LOCAL_INCLUDES += [ '/media/webrtc/signaling', '/media/webrtc/trunk',
--- a/dom/media/webrtc/MediaEngineWebRTC.cpp +++ b/dom/media/webrtc/MediaEngineWebRTC.cpp @@ -1,17 +1,16 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set sw=2 ts=8 et ft=cpp : */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIPrefService.h" #include "nsIPrefBranch.h" -#include "CamerasUtils.h" #include "CSFLog.h" #include "prenv.h" #include "mozilla/Logging.h" #ifdef XP_WIN #include "mozilla/WindowsVersion.h" #endif
--- a/netwerk/base/Tickler.cpp +++ b/netwerk/base/Tickler.cpp @@ -28,48 +28,26 @@ Tickler::Tickler() , mEnabled(false) , mDelay(16) , mDuration(TimeDuration::FromMilliseconds(400)) , mFD(nullptr) { MOZ_ASSERT(NS_IsMainThread()); } -class TicklerThreadDestructor : public Runnable -{ -public: - explicit TicklerThreadDestructor(nsIThread *aThread) - : mThread(aThread) { } - - NS_IMETHOD Run() override - { - MOZ_ASSERT(NS_IsMainThread()); - if (mThread) - mThread->Shutdown(); - return NS_OK; - } - -private: - ~TicklerThreadDestructor() { } - nsCOMPtr<nsIThread> mThread; -}; - Tickler::~Tickler() { // non main thread uses of the tickler should hold weak // references to it if they must hold a reference at all MOZ_ASSERT(NS_IsMainThread()); - // Shutting down a thread can spin the event loop - which is a surprising - // thing to do from a dtor. Running it on its own event is safer. - nsCOMPtr<nsIRunnable> event = new TicklerThreadDestructor(mThread); - if (NS_FAILED(NS_DispatchToCurrentThread(event))) { - mThread->Shutdown(); + if (mThread) { + mThread->AsyncShutdown(); + mThread = nullptr; } - mThread = nullptr; if (mTimer) mTimer->Cancel(); if (mFD) PR_Close(mFD); } nsresult