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

Side by Side Diff: webkit/glue/webfileutilities_impl.cc

Issue 9288084: Added Net logging to FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed copyright issue. Created 8 years, 10 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) 2011 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 "webkit/glue/webfileutilities_impl.h" 5 #include "webkit/glue/webfileutilities_impl.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/base/file_stream.h" 10 #include "net/base/file_stream.h"
11 #include "net/base/net_util.h" 11 #include "net/base/net_util.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return; 120 return;
121 if (base::ClosePlatformFile(handle)) 121 if (base::ClosePlatformFile(handle))
122 handle = base::kInvalidPlatformFileValue; 122 handle = base::kInvalidPlatformFileValue;
123 } 123 }
124 124
125 long long WebFileUtilitiesImpl::seekFile(base::PlatformFile handle, 125 long long WebFileUtilitiesImpl::seekFile(base::PlatformFile handle,
126 long long offset, 126 long long offset,
127 int origin) { 127 int origin) {
128 if (handle == base::kInvalidPlatformFileValue) 128 if (handle == base::kInvalidPlatformFileValue)
129 return -1; 129 return -1;
130 net::FileStream file_stream(handle, 0); 130 net::FileStream file_stream(handle, 0, NULL);
131 return file_stream.Seek(static_cast<net::Whence>(origin), offset); 131 return file_stream.Seek(static_cast<net::Whence>(origin), offset);
132 } 132 }
133 133
134 bool WebFileUtilitiesImpl::truncateFile(base::PlatformFile handle, 134 bool WebFileUtilitiesImpl::truncateFile(base::PlatformFile handle,
135 long long offset) { 135 long long offset) {
136 if (handle == base::kInvalidPlatformFileValue || offset < 0) 136 if (handle == base::kInvalidPlatformFileValue || offset < 0)
137 return false; 137 return false;
138 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE); 138 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE, NULL);
139 return file_stream.Truncate(offset) >= 0; 139 return file_stream.Truncate(offset) >= 0;
140 } 140 }
141 141
142 int WebFileUtilitiesImpl::readFromFile(base::PlatformFile handle, 142 int WebFileUtilitiesImpl::readFromFile(base::PlatformFile handle,
143 char* data, 143 char* data,
144 int length) { 144 int length) {
145 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) 145 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0)
146 return -1; 146 return -1;
147 std::string buffer; 147 std::string buffer;
148 buffer.resize(length); 148 buffer.resize(length);
149 net::FileStream file_stream(handle, base::PLATFORM_FILE_READ); 149 net::FileStream file_stream(handle, base::PLATFORM_FILE_READ, NULL);
150 return file_stream.Read(data, length, net::CompletionCallback()); 150 return file_stream.Read(data, length, net::CompletionCallback());
151 } 151 }
152 152
153 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, 153 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle,
154 const char* data, 154 const char* data,
155 int length) { 155 int length) {
156 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) 156 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0)
157 return -1; 157 return -1;
158 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE); 158 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE, NULL);
159 return file_stream.Write(data, length, net::CompletionCallback()); 159 return file_stream.Write(data, length, net::CompletionCallback());
160 } 160 }
161 161
162 } // namespace webkit_glue 162 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/fileapi/file_writer_delegate.cc ('k') | webkit/tools/test_shell/simple_resource_loader_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698