gecko/ipc/ril/Ril.h
Thomas Zimmermann 3968e49ba6 Bug 1171994: Use |RilSocket| to handle RIL messages on the RIL worker, r=htsai
This patch finally breaks up forwarding received RIL messages to the
main thread before they go to the RIL worker. Any RIL message that is
received on th I/O thread is forwarded directly to the RIL worker
thread and handed over to the RIL worker JS code.

The patch includes a number of changes. They all depend on each other,
so there's no good way of landing them one-by-one.

 * |RilConsumer| now runs on the RIL worker thread.

 * |RilWorker| uses tasks to register/unregister |RilConsumer| in the worker.

 * |RilConsumer| uses |RilSocket| instead of |StreamSocket|.

 * With |RilSocket|, received RIL messages do not go through main. They are
   forwared to the RIL worker and handed over to JS immediately.
2015-07-17 12:10:01 +02:00

55 lines
1.2 KiB
C++

/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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_ipc_Ril_h
#define mozilla_ipc_Ril_h 1
#include "nsAutoPtr.h"
#include "nsError.h"
#include "nsTArray.h"
namespace mozilla {
namespace dom {
namespace workers {
class WorkerCrossThreadDispatcher;
} // namespace workers
} // namespace dom
namespace ipc {
class RilConsumer;
class RilWorker final
{
public:
static nsresult Register(
unsigned int aClientId,
mozilla::dom::workers::WorkerCrossThreadDispatcher* aDispatcher);
static void Shutdown();
private:
class RegisterConsumerTask;
class UnregisterConsumerTask;
RilWorker(mozilla::dom::workers::WorkerCrossThreadDispatcher* aDispatcher);
nsresult RegisterConsumer(unsigned int aClientId);
void UnregisterConsumer(unsigned int aClientId);
static nsTArray<nsAutoPtr<RilWorker>> sRilWorkers;
nsRefPtr<mozilla::dom::workers::WorkerCrossThreadDispatcher> mDispatcher;
};
} // namespace ipc
} // namespace mozilla
#endif // mozilla_ipc_Ril_h