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

Side by Side Diff: content/renderer/pepper/pepper_file_io_host.h

Issue 20777009: A few more cleanups to the pepper code. Dispatch IPCs in the sockets implementations directly by ha… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix browsertest Created 7 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/id_map.h"
13 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
14 #include "base/platform_file.h" 15 #include "base/platform_file.h"
15 #include "content/public/renderer/renderer_ppapi_host.h" 16 #include "content/public/renderer/renderer_ppapi_host.h"
17 #include "ipc/ipc_listener.h"
18 #include "ipc/ipc_platform_file.h"
16 #include "ppapi/host/host_message_context.h" 19 #include "ppapi/host/host_message_context.h"
17 #include "ppapi/host/resource_host.h" 20 #include "ppapi/host/resource_host.h"
18 #include "ppapi/shared_impl/file_io_state_manager.h" 21 #include "ppapi/shared_impl/file_io_state_manager.h"
19 #include "ppapi/thunk/ppb_file_ref_api.h" 22 #include "ppapi/thunk/ppb_file_ref_api.h"
20 #include "url/gurl.h" 23 #include "url/gurl.h"
21 #include "webkit/common/quota/quota_types.h" 24 #include "webkit/common/quota/quota_types.h"
22 25
23 using ppapi::host::ReplyMessageContext; 26 using ppapi::host::ReplyMessageContext;
24 27
25 namespace content { 28 namespace content {
26 class QuotaFileIO; 29 class QuotaFileIO;
27 30
28 class PepperFileIOHost : public ppapi::host::ResourceHost, 31 class PepperFileIOHost : public ppapi::host::ResourceHost,
29 public base::SupportsWeakPtr<PepperFileIOHost> { 32 public base::SupportsWeakPtr<PepperFileIOHost>,
33 public IPC::Listener {
30 public: 34 public:
31 typedef base::Callback<void (base::PlatformFileError)> 35 typedef base::Callback<void (base::PlatformFileError)>
32 NotifyCloseFileCallback; 36 NotifyCloseFileCallback;
33 37
34 PepperFileIOHost(RendererPpapiHost* host, 38 PepperFileIOHost(RendererPpapiHost* host,
35 PP_Instance instance, 39 PP_Instance instance,
36 PP_Resource resource); 40 PP_Resource resource);
37 virtual ~PepperFileIOHost(); 41 virtual ~PepperFileIOHost();
38 42
39 // ppapi::host::ResourceHost override. 43 // ppapi::host::ResourceHost override.
40 virtual int32_t OnResourceMessageReceived( 44 virtual int32_t OnResourceMessageReceived(
41 const IPC::Message& msg, 45 const IPC::Message& msg,
42 ppapi::host::HostMessageContext* context) OVERRIDE; 46 ppapi::host::HostMessageContext* context) OVERRIDE;
43 47
44 private: 48 private:
49 // IPC::Listener implementation.
50 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
51
52 void OnAsyncFileOpened(
53 base::PlatformFileError error_code,
54 IPC::PlatformFileForTransit file_for_transit,
55 int message_id);
56
45 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, 57 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context,
46 PP_Resource file_ref_resource, 58 PP_Resource file_ref_resource,
47 int32_t open_flags); 59 int32_t open_flags);
48 int32_t OnHostMsgQuery(ppapi::host::HostMessageContext* context); 60 int32_t OnHostMsgQuery(ppapi::host::HostMessageContext* context);
49 int32_t OnHostMsgTouch(ppapi::host::HostMessageContext* context, 61 int32_t OnHostMsgTouch(ppapi::host::HostMessageContext* context,
50 PP_Time last_access_time, 62 PP_Time last_access_time,
51 PP_Time last_modified_time); 63 PP_Time last_modified_time);
52 int32_t OnHostMsgRead(ppapi::host::HostMessageContext* context, 64 int32_t OnHostMsgRead(ppapi::host::HostMessageContext* context,
53 int64_t offset, 65 int64_t offset,
54 int32_t bytes_to_read); 66 int32_t bytes_to_read);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 scoped_ptr<QuotaFileIO> quota_file_io_; 129 scoped_ptr<QuotaFileIO> quota_file_io_;
118 130
119 bool is_running_in_process_; 131 bool is_running_in_process_;
120 132
121 int32_t open_flags_; 133 int32_t open_flags_;
122 134
123 base::WeakPtrFactory<PepperFileIOHost> weak_factory_; 135 base::WeakPtrFactory<PepperFileIOHost> weak_factory_;
124 136
125 ppapi::FileIOStateManager state_manager_; 137 ppapi::FileIOStateManager state_manager_;
126 138
139 int routing_id_;
140
141 typedef base::Callback<void (base::PlatformFileError, base::PassPlatformFile)>
142 AsyncOpenFileCallback;
143
144 IDMap<AsyncOpenFileCallback> pending_async_open_files_;
145
127 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); 146 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost);
128 }; 147 };
129 148
130 } // namespace content 149 } // namespace content
131 150
132 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ 151 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_browser_connection.cc ('k') | content/renderer/pepper/pepper_file_io_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698