nacl_service.h 1.0 KB

1234567891011121314151617181920212223242526272829
  1. // Copyright 2016 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 COMPONENTS_NACL_COMMON_NACL_SERVICE_H_
  5. #define COMPONENTS_NACL_COMMON_NACL_SERVICE_H_
  6. #include "base/memory/scoped_refptr.h"
  7. #include "base/task/single_thread_task_runner.h"
  8. #include "mojo/core/embedder/scoped_ipc_support.h"
  9. #include "mojo/public/cpp/system/message_pipe.h"
  10. // Helper which establishes and holds open an IPC connection to the parent
  11. // process. This should exist as long as IPC needs to be possible.
  12. class NaClService {
  13. public:
  14. explicit NaClService(
  15. scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner);
  16. ~NaClService();
  17. // Returns a message pipe to use for the client endpoint of a legacy IPC
  18. // Channel in this process. Must only be called once.
  19. mojo::ScopedMessagePipeHandle TakeChannelPipe();
  20. private:
  21. const mojo::core::ScopedIPCSupport ipc_support_;
  22. };
  23. #endif // COMPONENTS_NACL_COMMON_NACL_SERVICE_H_