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

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

Issue 249183004: Implement open_resource in non-SFI mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 months 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 | Annotate | Revision Log
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_MANIFEST_SERVICE_CHANNEL_H_ 5 #ifndef COMPONENTS_NACL_RENDERER_MANIFEST_SERVICE_CHANNEL_H_
6 #define COMPONENTS_NACL_RENDERER_MANIFEST_SERVICE_CHANNEL_H_ 6 #define COMPONENTS_NACL_RENDERER_MANIFEST_SERVICE_CHANNEL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/platform_file.h"
13 #include "base/process/process.h"
14 #include "base/synchronization/lock.h"
11 #include "ipc/ipc_listener.h" 15 #include "ipc/ipc_listener.h"
12 16
13 namespace base { 17 namespace base {
14 class WaitableEvent; 18 class WaitableEvent;
15 } // namespace base 19 } // namespace base
16 20
17 namespace IPC { 21 namespace IPC {
18 struct ChannelHandle; 22 struct ChannelHandle;
19 class Message; 23 class Message;
20 class SyncChannel; 24 class SyncChannel;
21 } // namespace IPC 25 } // namespace IPC
22 26
23 namespace nacl { 27 namespace nacl {
24 28
25 class ManifestServiceChannel : public IPC::Listener { 29 class ManifestServiceChannel : public IPC::Listener {
26 public: 30 public:
31 typedef base::Callback<void(const base::PlatformFile&)> OpenResourceCallback;
32
27 class Delegate { 33 class Delegate {
28 public: 34 public:
29 virtual ~Delegate() {} 35 virtual ~Delegate() {}
30 36
31 // Called when PPAPI initialization in the NaCl plugin is finished. 37 // Called when PPAPI initialization in the NaCl plugin is finished.
32 virtual void StartupInitializationComplete() = 0; 38 virtual void StartupInitializationComplete() = 0;
33 39
34 // TODO(hidehiko): Add OpenResource() here. 40 // Called when irt_open_resource() is invoked in the NaCl plugin.
41 // Upon completion, callback is invoked with the platform file.
42 virtual void OpenResource(
43 const std::string& key,
44 const OpenResourceCallback& callback) = 0;
35 }; 45 };
36 46
37 ManifestServiceChannel( 47 ManifestServiceChannel(
38 const IPC::ChannelHandle& handle, 48 const IPC::ChannelHandle& handle,
39 const base::Callback<void(int32_t)>& connected_callback, 49 const base::Callback<void(int32_t)>& connected_callback,
40 scoped_ptr<Delegate> delegate, 50 scoped_ptr<Delegate> delegate,
41 base::WaitableEvent* waitable_event); 51 base::WaitableEvent* waitable_event);
42 virtual ~ManifestServiceChannel(); 52 virtual ~ManifestServiceChannel();
43 53
54 void Send(IPC::Message* message);
55
44 // Listener implementation. 56 // Listener implementation.
45 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
46 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 58 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
47 virtual void OnChannelError() OVERRIDE; 59 virtual void OnChannelError() OVERRIDE;
48 60
49 private: 61 private:
50 void OnStartupInitializationComplete(); 62 void OnStartupInitializationComplete();
63 void OnOpenResource(const std::string& key, IPC::Message* reply);
64 #if !defined(OS_WIN)
65 void DidOpenResource(
66 IPC::Message* reply, const base::PlatformFile& platform_file);
67 #endif
51 68
52 base::Callback<void(int32_t)> connected_callback_; 69 base::Callback<void(int32_t)> connected_callback_;
53 scoped_ptr<Delegate> delegate_; 70 scoped_ptr<Delegate> delegate_;
54 scoped_ptr<IPC::SyncChannel> channel_; 71 scoped_ptr<IPC::SyncChannel> channel_;
55 72
73 // Note: This should remain the last member so it'll be destroyed and
74 // invalidate the weak pointers before any other members are destroyed.
75 base::WeakPtrFactory<ManifestServiceChannel> weak_ptr_factory_;
76
56 DISALLOW_COPY_AND_ASSIGN(ManifestServiceChannel); 77 DISALLOW_COPY_AND_ASSIGN(ManifestServiceChannel);
57 }; 78 };
58 79
59 } // namespace nacl 80 } // namespace nacl
60 81
61 #endif // COMPONENTS_NACL_RENDERER_MANIFEST_SERVICE_CHANNEL_H_ 82 #endif // COMPONENTS_NACL_RENDERER_MANIFEST_SERVICE_CHANNEL_H_
OLDNEW
« no previous file with comments | « components/nacl/loader/nonsfi/irt_resource_open.cc ('k') | components/nacl/renderer/manifest_service_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698