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

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

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 #include "ppapi/native_client/src/trusted/plugin/temporary_file.h" 5 #include "ppapi/native_client/src/trusted/plugin/temporary_file.h"
6 6
7 #include "native_client/src/include/portability_io.h" 7 #include "native_client/src/include/portability_io.h"
8 #include "native_client/src/shared/platform/nacl_check.h" 8 #include "native_client/src/shared/platform/nacl_check.h"
9 #include "native_client/src/trusted/service_runtime/include/sys/stat.h" 9 #include "native_client/src/trusted/service_runtime/include/sys/stat.h"
10 10
11 #include "ppapi/cpp/core.h" 11 #include "ppapi/cpp/core.h"
12 #include "ppapi/cpp/instance.h" 12 #include "ppapi/cpp/instance.h"
13 #include "ppapi/cpp/module.h" 13 #include "ppapi/cpp/module.h"
14 #include "ppapi/c/private/pp_file_handle.h" 14 #include "ppapi/c/private/pp_file_handle.h"
15 15
16 #include "ppapi/native_client/src/trusted/plugin/plugin.h" 16 #include "ppapi/native_client/src/trusted/plugin/plugin.h"
17 #include "ppapi/native_client/src/trusted/plugin/utility.h" 17 #include "ppapi/native_client/src/trusted/plugin/utility.h"
18 18
19 namespace plugin { 19 namespace plugin {
20 20
21 TempFile::TempFile(Plugin* plugin) : plugin_(plugin), 21 TempFile::TempFile(Plugin* plugin, PP_FileHandle handle)
22 internal_handle_(PP_kInvalidFileHandle) { 22 : plugin_(plugin),
23 } 23 internal_handle_(handle) { }
24 24
25 TempFile::~TempFile() { } 25 TempFile::~TempFile() { }
26 26
27 int32_t TempFile::Open(bool writeable) { 27 int32_t TempFile::Open(bool writeable) {
28 // TODO(teravest): Clean up this Open() behavior; this is really confusing as
29 // written.
30 if (internal_handle_ == PP_kInvalidFileHandle) {
31 internal_handle_ =
32 plugin_->nacl_interface()->CreateTemporaryFile(plugin_->pp_instance());
33 }
34
35 if (internal_handle_ == PP_kInvalidFileHandle) { 28 if (internal_handle_ == PP_kInvalidFileHandle) {
36 PLUGIN_PRINTF(("TempFile::Open failed w/ PP_kInvalidFileHandle\n")); 29 PLUGIN_PRINTF(("TempFile::Open failed w/ PP_kInvalidFileHandle\n"));
37 return PP_ERROR_FAILED; 30 return PP_ERROR_FAILED;
38 } 31 }
39 32
40 #if NACL_WINDOWS 33 #if NACL_WINDOWS
41 HANDLE handle = internal_handle_; 34 HANDLE handle = internal_handle_;
42 35
43 //////// Now try the posix view. 36 //////// Now try the posix view.
44 int rdwr_flag = writeable ? _O_RDWR : _O_RDONLY; 37 int rdwr_flag = writeable ? _O_RDWR : _O_RDONLY;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 81
89 PP_FileHandle TempFile::TakeFileHandle() { 82 PP_FileHandle TempFile::TakeFileHandle() {
90 PP_FileHandle to_return = internal_handle_; 83 PP_FileHandle to_return = internal_handle_;
91 internal_handle_ = PP_kInvalidFileHandle; 84 internal_handle_ = PP_kInvalidFileHandle;
92 read_wrapper_.release(); 85 read_wrapper_.release();
93 write_wrapper_.release(); 86 write_wrapper_.release();
94 return to_return; 87 return to_return;
95 } 88 }
96 89
97 } // namespace plugin 90 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/temporary_file.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698