#include "base/memory/weak_ptr.h"
#include "base/power_monitor/power_monitor.h"
#include "base/tracked_objects.h"
+#include "content/child/mojo/mojo_application.h"
#include "content/common/content_export.h"
#include "content/common/message_router.h"
#include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
-#include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
namespace base {
class MessageLoop;
class WebFrame;
} // namespace blink
-namespace webkit_glue {
-class ResourceLoaderBridge;
-} // namespace webkit_glue
-
namespace content {
class ChildHistogramMessageFilter;
class ChildResourceMessageFilter;
class ChildSharedBitmapManager;
class FileSystemDispatcher;
-class MojoApplication;
-class ServiceWorkerDispatcher;
class ServiceWorkerMessageFilter;
class QuotaDispatcher;
class QuotaMessageFilter;
struct RequestInfo;
// The main thread of a child process derives from this class.
-class CONTENT_EXPORT ChildThread
- : public IPC::Listener,
- public IPC::Sender,
- public NON_EXPORTED_BASE(mojo::ServiceProvider) {
+class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {
public:
+ struct CONTENT_EXPORT Options {
+ Options();
+ explicit Options(bool mojo);
+ Options(std::string name, bool mojo)
+ : channel_name(name), use_mojo_channel(mojo) {}
+
+ std::string channel_name;
+ bool use_mojo_channel;
+ };
+
// Creates the thread.
ChildThread();
// Used for single-process mode and for in process gpu mode.
- explicit ChildThread(const std::string& channel_name);
+ explicit ChildThread(const Options& options);
// ChildProcess::main_thread() is reset after Shutdown(), and before the
// destructor, so any subsystem that relies on ChildProcess::main_thread()
// must be terminated before Shutdown returns. In particular, if a subsystem
return file_system_dispatcher_.get();
}
- ServiceWorkerDispatcher* service_worker_dispatcher() const {
- return service_worker_dispatcher_.get();
- }
-
QuotaDispatcher* quota_dispatcher() const {
return quota_dispatcher_.get();
}
static void ShutdownThread();
#endif
+ ServiceRegistry* service_registry() const {
+ return mojo_application_->service_registry();
+ }
+
protected:
friend class ChildProcess;
virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
virtual void OnChannelError() OVERRIDE;
- // mojo::ServiceProvider implementation:
- virtual void ConnectToService(
- const mojo::String& service_url,
- const mojo::String& service_name,
- mojo::ScopedMessagePipeHandle message_pipe,
- const mojo::String& requestor_url) OVERRIDE;
-
private:
class ChildThreadMessageRouter : public MessageRouter {
public:
IPC::Sender* const sender_;
};
- void Init();
+ void Init(const Options& options);
+ scoped_ptr<IPC::SyncChannel> CreateChannel(bool use_mojo_channel);
// IPC message handlers.
void OnShutdown();
scoped_ptr<FileSystemDispatcher> file_system_dispatcher_;
- scoped_ptr<ServiceWorkerDispatcher> service_worker_dispatcher_;
-
scoped_ptr<QuotaDispatcher> quota_dispatcher_;
scoped_refptr<ChildHistogramMessageFilter> histogram_message_filter_;