mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1353629 - PBlob refactoring - part 2 - IPCStream must be available on PBackground, r=smaug
In order to use IPCBlob in any IPC protocol, IPCStream must be available also on PBackground.
This commit is contained in:
parent
f3bd4e6da7
commit
4f87431fb2
@ -128,21 +128,24 @@ IPCStreamSource::Initialize()
|
||||
}
|
||||
|
||||
// A source can be used on any thread, but we only support IPCStream on
|
||||
// main thread and Worker threads right now. This is due to the requirement
|
||||
// that the thread be guaranteed to live long enough to receive messages.
|
||||
// We can enforce this guarantee with a feature on worker threads, but not
|
||||
// other threads.
|
||||
// main thread, Workers and PBackground thread right now. This is due
|
||||
// to the requirement that the thread be guaranteed to live long enough to
|
||||
// receive messages. We can enforce this guarantee with a WorkerHolder on
|
||||
// worker threads, but not other threads. Main-thread and PBackground thread
|
||||
// do not need anything special in order to be kept alive.
|
||||
WorkerPrivate* workerPrivate = nullptr;
|
||||
if (!NS_IsMainThread()) {
|
||||
workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_RELEASE_ASSERT(workerPrivate);
|
||||
if (workerPrivate) {
|
||||
bool result = HoldWorker(workerPrivate, Canceling);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool result = HoldWorker(workerPrivate, Canceling);
|
||||
if (!result) {
|
||||
return false;
|
||||
mWorkerPrivate = workerPrivate;
|
||||
} else {
|
||||
AssertIsOnBackgroundThread();
|
||||
}
|
||||
|
||||
mWorkerPrivate = workerPrivate;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -186,7 +189,6 @@ void
|
||||
IPCStreamSource::Start()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(IPCStreamSource);
|
||||
MOZ_ASSERT_IF(!NS_IsMainThread(), mWorkerPrivate);
|
||||
DoRead();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user