ipc_channel_factory.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef IPC_IPC_CHANNEL_FACTORY_H_
  5. #define IPC_IPC_CHANNEL_FACTORY_H_
  6. #include <memory>
  7. #include <string>
  8. #include <vector>
  9. #include "base/component_export.h"
  10. #include "base/memory/ref_counted.h"
  11. #include "base/task/single_thread_task_runner.h"
  12. #include "ipc/ipc_channel.h"
  13. namespace mojo {
  14. namespace internal {
  15. class MessageQuotaChecker;
  16. } // namespace internal
  17. } // namespace mojo
  18. namespace IPC {
  19. // Encapsulates how a Channel is created. A ChannelFactory can be
  20. // passed to the constructor of ChannelProxy or SyncChannel to tell them
  21. // how to create underlying channel.
  22. class COMPONENT_EXPORT(IPC) ChannelFactory {
  23. public:
  24. // Creates a factory for "native" channel built through
  25. // IPC::Channel::Create().
  26. static std::unique_ptr<ChannelFactory> Create(
  27. const ChannelHandle& handle,
  28. Channel::Mode mode,
  29. const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner);
  30. virtual ~ChannelFactory() { }
  31. virtual std::unique_ptr<Channel> BuildChannel(Listener* listener) = 0;
  32. virtual scoped_refptr<base::SingleThreadTaskRunner> GetIPCTaskRunner() = 0;
  33. virtual scoped_refptr<mojo::internal::MessageQuotaChecker>
  34. GetQuotaChecker() = 0;
  35. };
  36. } // namespace IPC
  37. #endif // IPC_IPC_CHANNEL_FACTORY_H_