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

Side by Side Diff: content/worker/worker_webkitplatformsupport_impl.cc

Issue 10453037: Deprecate FileUtilities::getFileSize and getFileModifiedTime (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 "content/worker/worker_webkitplatformsupport_impl.h" 5 #include "content/worker/worker_webkitplatformsupport_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/platform_file.h" 8 #include "base/platform_file.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/common/database_util.h" 10 #include "content/common/database_util.h"
(...skipping 25 matching lines...) Expand all
36 using WebKit::WebSharedWorkerRepository; 36 using WebKit::WebSharedWorkerRepository;
37 using WebKit::WebStorageNamespace; 37 using WebKit::WebStorageNamespace;
38 using WebKit::WebString; 38 using WebKit::WebString;
39 using WebKit::WebURL; 39 using WebKit::WebURL;
40 40
41 // TODO(kinuko): Probably this could be consolidated into 41 // TODO(kinuko): Probably this could be consolidated into
42 // RendererWebKitPlatformSupportImpl::FileUtilities. 42 // RendererWebKitPlatformSupportImpl::FileUtilities.
43 class WorkerWebKitPlatformSupportImpl::FileUtilities 43 class WorkerWebKitPlatformSupportImpl::FileUtilities
44 : public webkit_glue::WebFileUtilitiesImpl { 44 : public webkit_glue::WebFileUtilitiesImpl {
45 public: 45 public:
46 virtual bool getFileSize(const WebKit::WebString& path, long long& result);
47 virtual bool getFileModificationTime(const WebKit::WebString& path,
48 double& result);
49 virtual bool getFileInfo(const WebString& path, WebFileInfo& result); 46 virtual bool getFileInfo(const WebString& path, WebFileInfo& result);
50 }; 47 };
51 48
52 static bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) { 49 static bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) {
53 WorkerThread* worker_thread = WorkerThread::current(); 50 WorkerThread* worker_thread = WorkerThread::current();
54 if (worker_thread) 51 if (worker_thread)
55 return worker_thread->Send(msg); 52 return worker_thread->Send(msg);
56 53
57 scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter( 54 scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter(
58 ChildThread::current()->sync_message_filter()); 55 ChildThread::current()->sync_message_filter());
59 return sync_msg_filter->Send(msg); 56 return sync_msg_filter->Send(msg);
60 } 57 }
61 58
62 bool WorkerWebKitPlatformSupportImpl::FileUtilities::getFileSize(
63 const WebString& path, long long& result) {
64 if (SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileSize(
65 webkit_glue::WebStringToFilePath(path),
66 reinterpret_cast<int64*>(&result)))) {
67 return result >= 0;
68 }
69
70 result = -1;
71 return false;
72 }
73
74 bool WorkerWebKitPlatformSupportImpl::FileUtilities::getFileModificationTime(
75 const WebString& path,
76 double& result) {
77 base::Time time;
78 if (SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileModificationTime(
79 webkit_glue::WebStringToFilePath(path), &time))) {
80 result = time.ToDoubleT();
81 return !time.is_null();
82 }
83
84 result = 0;
85 return false;
86 }
87
88 bool WorkerWebKitPlatformSupportImpl::FileUtilities::getFileInfo( 59 bool WorkerWebKitPlatformSupportImpl::FileUtilities::getFileInfo(
89 const WebString& path, 60 const WebString& path,
90 WebFileInfo& web_file_info) { 61 WebFileInfo& web_file_info) {
91 base::PlatformFileInfo file_info; 62 base::PlatformFileInfo file_info;
92 base::PlatformFileError status; 63 base::PlatformFileError status;
93 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( 64 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo(
94 webkit_glue::WebStringToFilePath(path), &file_info, &status)) || 65 webkit_glue::WebStringToFilePath(path), &file_info, &status)) ||
95 status != base::PLATFORM_FILE_OK) { 66 status != base::PLATFORM_FILE_OK) {
96 return false; 67 return false;
97 } 68 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 new MimeRegistryMsg_GetPreferredExtensionForMimeType( 277 new MimeRegistryMsg_GetPreferredExtensionForMimeType(
307 UTF16ToASCII(mime_type), &file_extension)); 278 UTF16ToASCII(mime_type), &file_extension));
308 return webkit_glue::FilePathStringToWebString(file_extension); 279 return webkit_glue::FilePathStringToWebString(file_extension);
309 } 280 }
310 281
311 WebBlobRegistry* WorkerWebKitPlatformSupportImpl::blobRegistry() { 282 WebBlobRegistry* WorkerWebKitPlatformSupportImpl::blobRegistry() {
312 if (!blob_registry_.get()) 283 if (!blob_registry_.get())
313 blob_registry_.reset(new WebBlobRegistryImpl(WorkerThread::current())); 284 blob_registry_.reset(new WebBlobRegistryImpl(WorkerThread::current()));
314 return blob_registry_.get(); 285 return blob_registry_.get();
315 } 286 }
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | webkit/glue/webfileutilities_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698