Backed out changeset 152d46945b27 (bug 1628201) for causing bustages regarding UniquePtr.

CLOSED TREE

--HG--
extra : histedit_source : ddf57bae286966a214cc11f360a125bf81d5ecdd
This commit is contained in:
Mihai Alexandru Michis 2020-04-09 20:54:53 +03:00
parent 587d6bcab6
commit 5fe59763c4
7 changed files with 10 additions and 13 deletions

View File

@ -75,7 +75,6 @@ enum ThreadType {
struct RunnableTask {
virtual ThreadType threadType() = 0;
virtual void runTask() = 0;
virtual ~RunnableTask() = default;
};
namespace oom {

View File

@ -1908,7 +1908,7 @@ JS_PUBLIC_API void JS::AssertObjectBelongsToCurrentThread(JSObject* obj) {
}
JS_PUBLIC_API void SetHelperThreadTaskCallback(
void (*callback)(js::UniquePtr<js::RunnableTask>)) {
void (*callback)(js::RunnableTask*)) {
HelperThreadTaskCallback = callback;
}

View File

@ -311,7 +311,7 @@ JS_PUBLIC_API void SetFilenameValidationCallback(FilenameValidationCallback cb);
* Set callback to send tasks to XPCOM thread pools
*/
JS_PUBLIC_API void SetHelperThreadTaskCallback(
void (*callback)(js::UniquePtr<js::RunnableTask>));
void (*callback)(js::RunnableTask*));
extern JS_PUBLIC_API const char* JS_GetImplementationVersion(void);

View File

@ -71,7 +71,7 @@ Atomic<JS::LargeAllocationFailureCallback> js::OnLargeAllocationFailure;
JS::FilenameValidationCallback js::gFilenameValidationCallback = nullptr;
namespace js {
void (*HelperThreadTaskCallback)(UniquePtr<RunnableTask>);
void (*HelperThreadTaskCallback)(js::RunnableTask*);
bool gCanUseExtraThreads = true;
} // namespace js

View File

@ -1116,7 +1116,7 @@ extern JS::FilenameValidationCallback gFilenameValidationCallback;
// This callback is set by js::SetHelperThreadTaskCallback and may be null.
// See comment in jsapi.h.
extern void (*HelperThreadTaskCallback)(js::UniquePtr<js::RunnableTask>);
extern void (*HelperThreadTaskCallback)(js::RunnableTask*);
} /* namespace js */

View File

@ -1060,8 +1060,8 @@ StaticAutoPtr<HelperThreadPool> gHelperThreads;
void InitializeHelperThreadPool() { gHelperThreads = new HelperThreadPool(); }
void DispatchOffThreadTask(js::UniquePtr<RunnableTask> task) {
gHelperThreads->Dispatch(MakeAndAddRef<HelperThreadTaskHandler>(std::move(task)));
void DispatchOffThreadTask(RunnableTask* task) {
gHelperThreads->Dispatch(MakeAndAddRef<HelperThreadTaskHandler>(task));
}
void XPCJSRuntime::Shutdown(JSContext* cx) {

View File

@ -7,10 +7,8 @@
#ifndef mozilla_JSThreadPool_h
#define mozilla_JSThreadPool_h
#include "mozilla/Unused.h"
#include "nsIThreadPool.h"
#include "js/Utility.h"
#include "js/UniquePtr.h"
namespace mozilla {
/*
@ -22,15 +20,15 @@ class HelperThreadTaskHandler : public Runnable {
public:
NS_IMETHOD Run() override {
mOffThreadTask->runTask();
Unused << mOffThreadTask.release();
mOffThreadTask = nullptr;
return NS_OK;
}
explicit HelperThreadTaskHandler(js::UniquePtr<RunnableTask> task)
: Runnable("HelperThreadTaskHandler"), mOffThreadTask(std::move(task)) {}
explicit HelperThreadTaskHandler(RunnableTask* task)
: Runnable("HelperThreadTaskHandler"), mOffThreadTask(task) {}
private:
~HelperThreadTaskHandler() = default;
js::UniquePtr<RunnableTask> mOffThreadTask;
RunnableTask* mOffThreadTask;
};
/*