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

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

Issue 393693004: Pepper: Delete FileDownloader in trusted plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: STL fix Created 6 years, 5 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_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/trusted/desc/nacl_desc_wrapper.h" 9 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 // TempFile represents a file used as a temporary between stages in 30 // TempFile represents a file used as a temporary between stages in
31 // translation. It is automatically deleted when all handles are closed 31 // translation. It is automatically deleted when all handles are closed
32 // (or earlier -- immediately unlinked on POSIX systems). The file is only 32 // (or earlier -- immediately unlinked on POSIX systems). The file is only
33 // opened, once, but because both reading and writing are necessary (and in 33 // opened, once, but because both reading and writing are necessary (and in
34 // different processes), the user should reset / seek back to the beginning 34 // different processes), the user should reset / seek back to the beginning
35 // of the file between sessions. 35 // of the file between sessions.
36 class TempFile { 36 class TempFile {
37 public: 37 public:
38 // Create a TempFile. 38 // Create a TempFile.
39 explicit TempFile(Plugin* plugin); 39 TempFile(Plugin* plugin, PP_FileHandle handle);
40 ~TempFile(); 40 ~TempFile();
41 41
42 // Opens a temporary file object and descriptor wrapper referring to the file. 42 // Opens a temporary file object and descriptor wrapper referring to the file.
43 // If |writeable| is true, the descriptor will be opened for writing, and 43 // If |writeable| is true, the descriptor will be opened for writing, and
44 // write_wrapper will return a valid pointer, otherwise it will return NULL. 44 // write_wrapper will return a valid pointer, otherwise it will return NULL.
45 int32_t Open(bool writeable); 45 int32_t Open(bool writeable);
46 // Resets file position of the handle, for reuse. 46 // Resets file position of the handle, for reuse.
47 bool Reset(); 47 bool Reset();
48 48
49 // Accessors. 49 // Accessors.
50 // The nacl::DescWrapper* for the writeable version of the file. 50 // The nacl::DescWrapper* for the writeable version of the file.
51 nacl::DescWrapper* write_wrapper() { return write_wrapper_.get(); } 51 nacl::DescWrapper* write_wrapper() { return write_wrapper_.get(); }
52 nacl::DescWrapper* read_wrapper() { return read_wrapper_.get(); } 52 nacl::DescWrapper* read_wrapper() { return read_wrapper_.get(); }
53 53
54 // Returns the handle to the file repesented and resets the internal handle 54 // Returns the handle to the file repesented and resets the internal handle
55 // and all wrappers. 55 // and all wrappers.
56 PP_FileHandle TakeFileHandle(); 56 PP_FileHandle TakeFileHandle();
57 57
58 // Used by GetNexeFd() to set the underlying internal handle.
59 PP_FileHandle* internal_handle() { return &internal_handle_; }
60
61 private: 58 private:
62 NACL_DISALLOW_COPY_AND_ASSIGN(TempFile); 59 NACL_DISALLOW_COPY_AND_ASSIGN(TempFile);
63 60
64 Plugin* plugin_; 61 Plugin* plugin_;
65 nacl::scoped_ptr<nacl::DescWrapper> read_wrapper_; 62 nacl::scoped_ptr<nacl::DescWrapper> read_wrapper_;
66 nacl::scoped_ptr<nacl::DescWrapper> write_wrapper_; 63 nacl::scoped_ptr<nacl::DescWrapper> write_wrapper_;
67 PP_FileHandle internal_handle_; 64 PP_FileHandle internal_handle_;
68 }; 65 };
69 66
70 } // namespace plugin 67 } // namespace plugin
71 68
72 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_TEMPORARY_FILE_H_ 69 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_TEMPORARY_FILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698