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

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

Issue 301743003: Pepper: PnaclResources cleanup. (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 Manifest;
23 class Plugin; 22 class Plugin;
24 class PnaclCoordinator; 23 class PnaclCoordinator;
25 24
26 // Constants for loading LLC and LD. 25 // Constants for loading LLC and LD.
27 class PnaclUrls { 26 class PnaclUrls {
28 public: 27 public:
29 // Get the base URL prefix for Pnacl resources (without platform prefix).
30 static nacl::string GetBaseUrl();
31
32 static bool IsPnaclComponent(const nacl::string& full_url); 28 static bool IsPnaclComponent(const nacl::string& full_url);
33 static nacl::string PnaclComponentURLToFilename( 29 static nacl::string PnaclComponentURLToFilename(
34 const nacl::string& full_url); 30 const nacl::string& full_url);
35
36 // Get the URL for the resource info JSON file that contains information
37 // about loadable resources.
38 static nacl::string GetResourceInfoUrl();
39 }; 31 };
40 32
41 // Loads a list of resources, providing a way to get file descriptors for 33 // Loads a list of resources, providing a way to get file descriptors for
42 // these resources. URLs for resources are resolved by the manifest 34 // these resources. URLs for resources are resolved by the manifest
43 // and point to pnacl component filesystem resources. 35 // and point to pnacl component filesystem resources.
44 class PnaclResources { 36 class PnaclResources {
45 public: 37 public:
46 PnaclResources(Plugin* plugin, 38 PnaclResources(Plugin* plugin,
47 PnaclCoordinator* coordinator) 39 PnaclCoordinator* coordinator)
48 : plugin_(plugin), 40 : plugin_(plugin),
49 coordinator_(coordinator), 41 coordinator_(coordinator),
50 llc_file_handle_(PP_kInvalidFileHandle), 42 llc_file_handle_(PP_kInvalidFileHandle),
51 ld_file_handle_(PP_kInvalidFileHandle) { 43 ld_file_handle_(PP_kInvalidFileHandle) {
52 } 44 }
53 virtual ~PnaclResources(); 45 virtual ~PnaclResources();
54 46
55 // Read the resource info JSON file. This is the first step after 47 // Read the resource info JSON file. This is the first step after
56 // construction; it has to be completed before StartLoad is called. 48 // construction; it has to be completed before StartLoad is called.
57 virtual void ReadResourceInfo( 49 virtual void ReadResourceInfo(
58 const nacl::string& resource_info_url,
59 const pp::CompletionCallback& resource_info_read_cb); 50 const pp::CompletionCallback& resource_info_read_cb);
60 51
61 // Start loading the resources. 52 // Start loading the resources.
62 virtual void StartLoad( 53 virtual void StartLoad(
63 const pp::CompletionCallback& all_loaded_callback); 54 const pp::CompletionCallback& all_loaded_callback);
64 55
65 const nacl::string& GetLlcUrl() { return llc_tool_name_; } 56 const nacl::string& GetLlcUrl() { return llc_tool_name_; }
66 const nacl::string& GetLdUrl() { return ld_tool_name_; } 57 const nacl::string& GetLdUrl() { return ld_tool_name_; }
67 58
68 PP_FileHandle TakeLlcFileHandle(); 59 PP_FileHandle TakeLlcFileHandle();
(...skipping 13 matching lines...) Expand all
82 73
83 // File handles for llc and ld executables, after they've been opened. 74 // File handles for llc and ld executables, after they've been opened.
84 // Only valid after the callback for StartLoad() has been called, and until 75 // Only valid after the callback for StartLoad() has been called, and until
85 // TakeLlcFileHandle()/TakeLdFileHandle() is called. 76 // TakeLlcFileHandle()/TakeLdFileHandle() is called.
86 PP_FileHandle llc_file_handle_; 77 PP_FileHandle llc_file_handle_;
87 PP_FileHandle ld_file_handle_; 78 PP_FileHandle ld_file_handle_;
88 }; 79 };
89 80
90 } // namespace plugin; 81 } // namespace plugin;
91 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ 82 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698