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

Side by Side Diff: webkit/blob/blob_url_request_job.cc

Issue 3347005: Moving file_util::FileInfo to base::PlatformFileInfo, and adding the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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) 20010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 20010 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/blob/blob_url_request_job.h" 5 #include "webkit/blob/blob_url_request_job.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/file_util_proxy.h" 9 #include "base/file_util_proxy.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 base::FileUtilProxy::GetFileInfo( 98 base::FileUtilProxy::GetFileInfo(
99 file_thread_proxy_, 99 file_thread_proxy_,
100 file_path, 100 file_path,
101 callback_factory_.NewCallback(&BlobURLRequestJob::DidResolve)); 101 callback_factory_.NewCallback(&BlobURLRequestJob::DidResolve));
102 return; 102 return;
103 } 103 }
104 104
105 // Otherwise, we use current thread, i.e. IO thread, as this is the case when 105 // Otherwise, we use current thread, i.e. IO thread, as this is the case when
106 // we run the unittest or test shell. 106 // we run the unittest or test shell.
107 // TODO(jianli): Consider using the proxy of current thread. 107 // TODO(jianli): Consider using the proxy of current thread.
108 file_util::FileInfo file_info; 108 base::PlatformFileInfo file_info;
109 bool exists = file_util::GetFileInfo(file_path, &file_info); 109 bool exists = file_util::GetFileInfo(file_path, &file_info);
110 110
111 // Continue asynchronously. 111 // Continue asynchronously.
112 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( 112 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
113 this, &BlobURLRequestJob::DidResolve, 113 this, &BlobURLRequestJob::DidResolve,
114 (exists ? base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_NOT_FOUND), 114 (exists ? base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_NOT_FOUND),
115 file_info)); 115 file_info));
116 } 116 }
117 117
118 void BlobURLRequestJob::DidResolve(base::PlatformFileError rv, 118 void BlobURLRequestJob::DidResolve(base::PlatformFileError rv,
119 const file_util::FileInfo& file_info) { 119 const base::PlatformFileInfo& file_info) {
120 // We may have been orphaned... 120 // We may have been orphaned...
121 if (!request_) 121 if (!request_)
122 return; 122 return;
123 123
124 // If an error occured, bail out. 124 // If an error occured, bail out.
125 if (rv == base::PLATFORM_FILE_ERROR_NOT_FOUND) { 125 if (rv == base::PLATFORM_FILE_ERROR_NOT_FOUND) {
126 NotifyFailure(net::ERR_FILE_NOT_FOUND); 126 NotifyFailure(net::ERR_FILE_NOT_FOUND);
127 return; 127 return;
128 } else if (rv != base::PLATFORM_FILE_OK) { 128 } else if (rv != base::PLATFORM_FILE_OK) {
129 NotifyFailure(net::ERR_FAILED); 129 NotifyFailure(net::ERR_FAILED);
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // We don't support multiple range requests in one single URL request, 532 // We don't support multiple range requests in one single URL request,
533 // because we need to do multipart encoding here. 533 // because we need to do multipart encoding here.
534 // TODO(jianli): Support multipart byte range requests. 534 // TODO(jianli): Support multipart byte range requests.
535 NotifyFailure(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE); 535 NotifyFailure(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE);
536 } 536 }
537 } 537 }
538 } 538 }
539 } 539 }
540 540
541 } // namespace webkit_blob 541 } // namespace webkit_blob
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698