OLD | NEW |
---|---|
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_TEMPORARY_FILE_H_ | 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_TEMPORARY_FILE_H_ |
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_TEMPORARY_FILE_H_ | 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_TEMPORARY_FILE_H_ |
7 | 7 |
8 #include "native_client/src/include/nacl_macros.h" | 8 #include "native_client/src/include/nacl_macros.h" |
9 #include "native_client/src/include/nacl_string.h" | 9 #include "native_client/src/include/nacl_string.h" |
jvoung (off chromium)
2014/05/22 16:22:48
no longer need nacl_string?
| |
10 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 10 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
11 | 11 |
12 #include "ppapi/c/private/pp_file_handle.h" | 12 #include "ppapi/c/private/pp_file_handle.h" |
13 #include "ppapi/cpp/completion_callback.h" | 13 #include "ppapi/cpp/completion_callback.h" |
14 | 14 |
15 namespace plugin { | 15 namespace plugin { |
16 | 16 |
17 class Plugin; | 17 class Plugin; |
18 | 18 |
19 // Translation creates two temporary files. The first temporary file holds | 19 // Translation creates two temporary files. The first temporary file holds |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 // Accessors. | 51 // Accessors. |
52 // The nacl::DescWrapper* for the writeable version of the file. | 52 // The nacl::DescWrapper* for the writeable version of the file. |
53 nacl::DescWrapper* write_wrapper() { return write_wrapper_.get(); } | 53 nacl::DescWrapper* write_wrapper() { return write_wrapper_.get(); } |
54 nacl::DescWrapper* read_wrapper() { return read_wrapper_.get(); } | 54 nacl::DescWrapper* read_wrapper() { return read_wrapper_.get(); } |
55 nacl::DescWrapper* release_read_wrapper() { | 55 nacl::DescWrapper* release_read_wrapper() { |
56 return read_wrapper_.release(); | 56 return read_wrapper_.release(); |
57 } | 57 } |
58 | 58 |
59 PP_FileHandle* existing_handle() { return &existing_handle_; } | 59 PP_FileHandle* existing_handle() { return &existing_handle_; } |
60 | 60 |
61 // For quota management. | |
62 const nacl::string identifier() const { | |
63 return nacl::string(reinterpret_cast<const char*>(identifier_)); | |
64 } | |
65 | |
66 private: | 61 private: |
67 NACL_DISALLOW_COPY_AND_ASSIGN(TempFile); | 62 NACL_DISALLOW_COPY_AND_ASSIGN(TempFile); |
68 | 63 |
69 Plugin* plugin_; | 64 Plugin* plugin_; |
70 nacl::scoped_ptr<nacl::DescWrapper> read_wrapper_; | 65 nacl::scoped_ptr<nacl::DescWrapper> read_wrapper_; |
71 nacl::scoped_ptr<nacl::DescWrapper> write_wrapper_; | 66 nacl::scoped_ptr<nacl::DescWrapper> write_wrapper_; |
72 PP_FileHandle existing_handle_; | 67 PP_FileHandle existing_handle_; |
73 | |
74 // An identifier string used for quota request processing. The quota | |
75 // interface needs a string that is unique per sel_ldr instance only, so | |
76 // the identifiers can be reused between runs of the translator, start-ups of | |
77 // the browser, etc. | |
78 uint8_t identifier_[16]; | |
79 // A counter to dole out unique identifiers. | |
80 static uint32_t next_identifier; | |
81 }; | 68 }; |
82 | 69 |
83 } // namespace plugin | 70 } // namespace plugin |
84 | 71 |
85 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_TEMPORARY_FILE_H_ | 72 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_TEMPORARY_FILE_H_ |
OLD | NEW |