Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(649)

Side by Side Diff: components/nacl/renderer/trusted_plugin_channel.h

Issue 2525483002: Convert NaCl renderer-loader messages to mojo. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NACL_RENDERER_TRUSTED_PLUGIN_CHANNEL_H_ 5 #ifndef COMPONENTS_NACL_RENDERER_TRUSTED_PLUGIN_CHANNEL_H_
6 #define COMPONENTS_NACL_RENDERER_TRUSTED_PLUGIN_CHANNEL_H_ 6 #define COMPONENTS_NACL_RENDERER_TRUSTED_PLUGIN_CHANNEL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ipc/ipc_listener.h" 12 #include "components/nacl/common/nacl.mojom.h"
13 #include "mojo/public/cpp/bindings/binding.h"
13 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" 14 #include "native_client/src/trusted/service_runtime/nacl_error_code.h"
14 #include "ppapi/c/pp_instance.h" 15 #include "ppapi/c/pp_instance.h"
15 16
16 namespace base {
17 class WaitableEvent;
18 } // namespace base
19
20 namespace IPC {
21 struct ChannelHandle;
22 class Message;
23 class SyncChannel;
24 } // namespace IPC
25
26 namespace nacl { 17 namespace nacl {
27 class NexeLoadManager; 18 class NexeLoadManager;
28 19
29 class TrustedPluginChannel : public IPC::Listener { 20 class TrustedPluginChannel : public mojom::NaClRendererHost {
30 public: 21 public:
31 TrustedPluginChannel(NexeLoadManager* nexe_load_manager, 22 TrustedPluginChannel(NexeLoadManager* nexe_load_manager,
32 const IPC::ChannelHandle& handle, 23 mojom::NaClRendererHostRequest request,
33 base::WaitableEvent* shutdown_event,
34 bool is_helper_nexe); 24 bool is_helper_nexe);
35 ~TrustedPluginChannel() override; 25 ~TrustedPluginChannel() override;
36 26
37 bool Send(IPC::Message* message); 27 private:
28 void OnChannelError();
38 29
39 // Listener implementation. 30 // mojom::NaClRendererHost overrides.
40 bool OnMessageReceived(const IPC::Message& message) override; 31 void ReportExitStatus(int exit_status,
41 void OnChannelError() override; 32 const ReportExitStatusCallback& callback) override;
33 void ReportLoadStatus(NaClErrorCode load_status,
34 const ReportLoadStatusCallback& callback) override;
35 void ProvideExitControl(mojom::NaClExitControlPtr exit_control) override;
42 36
43 void OnReportExitStatus(int exit_status);
44 void OnReportLoadStatus(NaClErrorCode load_status);
45
46 private:
47 // Non-owning pointer. This is safe because the TrustedPluginChannel is owned 37 // Non-owning pointer. This is safe because the TrustedPluginChannel is owned
48 // by the NexeLoadManager pointed to here. 38 // by the NexeLoadManager pointed to here.
49 NexeLoadManager* nexe_load_manager_; 39 NexeLoadManager* nexe_load_manager_;
50 std::unique_ptr<IPC::SyncChannel> channel_; 40 mojo::Binding<mojom::NaClRendererHost> binding_;
51 bool is_helper_nexe_; 41 mojom::NaClExitControlPtr exit_control_;
42 const bool is_helper_nexe_;
52 43
53 DISALLOW_COPY_AND_ASSIGN(TrustedPluginChannel); 44 DISALLOW_COPY_AND_ASSIGN(TrustedPluginChannel);
54 }; 45 };
55 46
56 } // namespace nacl 47 } // namespace nacl
57 48
58 #endif // COMPONENTS_NACL_RENDERER_TRUSTED_PLUGIN_CHANNEL_H_ 49 #endif // COMPONENTS_NACL_RENDERER_TRUSTED_PLUGIN_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698