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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_resources.h

Issue 315583005: Pepper: Simplify error reporting in PnaclResources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "native_client/src/include/nacl_macros.h" 11 #include "native_client/src/include/nacl_macros.h"
12 #include "native_client/src/include/nacl_string.h" 12 #include "native_client/src/include/nacl_string.h"
13 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" 13 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
14 14
15 #include "ppapi/c/private/pp_file_handle.h" 15 #include "ppapi/c/private/pp_file_handle.h"
16 #include "ppapi/cpp/completion_callback.h" 16 #include "ppapi/cpp/completion_callback.h"
17 17
18 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" 18 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h"
19 19
20 namespace plugin { 20 namespace plugin {
21 21
22 class Plugin; 22 class Plugin;
23 class PnaclCoordinator; 23 class PnaclCoordinator;
dmichael (off chromium) 2014/06/03 19:52:51 nit: don't need this anymore
24 24
25 // Loads a list of resources, providing a way to get file descriptors for 25 // Loads a list of resources, providing a way to get file descriptors for
26 // these resources. URLs for resources are resolved by the manifest 26 // these resources. URLs for resources are resolved by the manifest
27 // and point to pnacl component filesystem resources. 27 // and point to pnacl component filesystem resources.
28 class PnaclResources { 28 class PnaclResources {
29 public: 29 public:
30 PnaclResources(Plugin* plugin, 30 explicit PnaclResources(Plugin* plugin)
31 PnaclCoordinator* coordinator)
32 : plugin_(plugin), 31 : plugin_(plugin),
33 coordinator_(coordinator),
34 llc_file_handle_(PP_kInvalidFileHandle), 32 llc_file_handle_(PP_kInvalidFileHandle),
35 ld_file_handle_(PP_kInvalidFileHandle) { 33 ld_file_handle_(PP_kInvalidFileHandle) {
36 } 34 }
37 virtual ~PnaclResources(); 35 virtual ~PnaclResources();
38 36
39 // Read the resource info JSON file. This is the first step after 37 // Read the resource info JSON file. This is the first step after
40 // construction; it has to be completed before StartLoad is called. 38 // construction; it has to be completed before StartLoad is called.
41 virtual void ReadResourceInfo( 39 virtual void ReadResourceInfo(
42 const pp::CompletionCallback& resource_info_read_cb); 40 const pp::CompletionCallback& resource_info_read_cb);
43 41
44 // Start loading the resources. 42 // Start loading the resources.
45 virtual void StartLoad( 43 virtual void StartLoad(
46 const pp::CompletionCallback& all_loaded_callback); 44 const pp::CompletionCallback& all_loaded_callback);
47 45
48 const nacl::string& GetLlcUrl() { return llc_tool_name_; } 46 const nacl::string& GetLlcUrl() { return llc_tool_name_; }
49 const nacl::string& GetLdUrl() { return ld_tool_name_; } 47 const nacl::string& GetLdUrl() { return ld_tool_name_; }
50 48
51 PP_FileHandle TakeLlcFileHandle(); 49 PP_FileHandle TakeLlcFileHandle();
52 PP_FileHandle TakeLdFileHandle(); 50 PP_FileHandle TakeLdFileHandle();
53 51
54 private: 52 private:
55 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclResources); 53 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclResources);
56 54
57 // The plugin requesting the resource loading. 55 // The plugin requesting the resource loading.
58 Plugin* plugin_; 56 Plugin* plugin_;
59 // The coordinator responsible for reporting errors, etc.
60 PnaclCoordinator* coordinator_;
61 57
62 // Tool names for llc and ld; read from the resource info file. 58 // Tool names for llc and ld; read from the resource info file.
63 nacl::string llc_tool_name_; 59 nacl::string llc_tool_name_;
64 nacl::string ld_tool_name_; 60 nacl::string ld_tool_name_;
65 61
66 // File handles for llc and ld executables, after they've been opened. 62 // File handles for llc and ld executables, after they've been opened.
67 // Only valid after the callback for StartLoad() has been called, and until 63 // Only valid after the callback for StartLoad() has been called, and until
68 // TakeLlcFileHandle()/TakeLdFileHandle() is called. 64 // TakeLlcFileHandle()/TakeLdFileHandle() is called.
69 PP_FileHandle llc_file_handle_; 65 PP_FileHandle llc_file_handle_;
70 PP_FileHandle ld_file_handle_; 66 PP_FileHandle ld_file_handle_;
71 }; 67 };
72 68
73 } // namespace plugin; 69 } // namespace plugin;
74 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ 70 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698