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

Side by Side Diff: components/nacl/renderer/plugin/temporary_file.cc

Issue 1615523003: PNaCl cleanup: Remove TempFile class and use base::File instead (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix Windows Created 4 years, 11 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/nacl/renderer/plugin/temporary_file.h"
6
7 #include "base/logging.h"
8 #include "build/build_config.h"
9 #include "components/nacl/renderer/plugin/plugin.h"
10 #include "components/nacl/renderer/plugin/utility.h"
11 #include "ppapi/c/private/pp_file_handle.h"
12 #include "ppapi/cpp/core.h"
13 #include "ppapi/cpp/instance.h"
14 #include "ppapi/cpp/module.h"
15
16 namespace plugin {
17
18 TempFile::TempFile(Plugin* plugin, PP_FileHandle handle)
19 : plugin_(plugin),
20 file_handle_(handle) { }
21
22 TempFile::~TempFile() { }
23
24 bool TempFile::Reset() {
25 // file_handle_, read_wrapper_ and write_wrapper_ are all backed by the
26 // same file handle/descriptor, so resetting the seek position of one
27 // will reset them all.
28 int64_t newpos = file_handle_.Seek(base::File::FROM_BEGIN, 0);
29 return newpos == 0;
30 }
31
32 int64_t TempFile::GetLength() {
33 return file_handle_.GetLength();
34 }
35
36 PP_FileHandle TempFile::TakeFileHandle() {
37 DCHECK(file_handle_.IsValid());
38 return file_handle_.TakePlatformFile();
39 }
40
41 PP_FileHandle TempFile::GetFileHandle() {
42 DCHECK(file_handle_.IsValid());
43 return file_handle_.GetPlatformFile();
44 }
45
46 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698