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

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

Issue 10536025: Set NaN instead of 0 for null modificationTime (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/glue/webkit_glue.h" 5 #include "webkit/glue/webkit_glue.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <objidl.h> 8 #include <objidl.h>
9 #include <mlang.h> 9 #include <mlang.h>
10 #elif defined(OS_POSIX) && !defined(OS_MACOSX) 10 #elif defined(OS_POSIX) && !defined(OS_MACOSX)
11 #include <sys/utsname.h> 11 #include <sys/utsname.h>
12 #endif 12 #endif
13 13
14 #include <limits>
15
14 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
15 #include "base/logging.h" 17 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
17 #include "base/path_service.h" 19 #include "base/path_service.h"
18 #include "base/string_piece.h" 20 #include "base/string_piece.h"
19 #include "base/string_tokenizer.h" 21 #include "base/string_tokenizer.h"
20 #include "base/string_util.h" 22 #include "base/string_util.h"
21 #include "base/stringprintf.h" 23 #include "base/stringprintf.h"
22 #include "base/synchronization/lock.h" 24 #include "base/synchronization/lock.h"
23 #include "base/sys_info.h" 25 #include "base/sys_info.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 } 322 }
321 323
322 WebString FilePathToWebString(const FilePath& file_path) { 324 WebString FilePathToWebString(const FilePath& file_path) {
323 return FilePathStringToWebString(file_path.value()); 325 return FilePathStringToWebString(file_path.value());
324 } 326 }
325 327
326 void PlatformFileInfoToWebFileInfo( 328 void PlatformFileInfoToWebFileInfo(
327 const base::PlatformFileInfo& file_info, 329 const base::PlatformFileInfo& file_info,
328 WebKit::WebFileInfo* web_file_info) { 330 WebKit::WebFileInfo* web_file_info) {
329 DCHECK(web_file_info); 331 DCHECK(web_file_info);
330 web_file_info->modificationTime = file_info.last_modified.ToDoubleT(); 332 // WebKit now expects NaN as uninitialized/null Date.
333 if (file_info.last_modified.is_null())
334 web_file_info->modificationTime = std::numeric_limits<double>::quiet_NaN();
335 else
336 web_file_info->modificationTime = file_info.last_modified.ToDoubleT();
331 web_file_info->length = file_info.size; 337 web_file_info->length = file_info.size;
332 if (file_info.is_directory) 338 if (file_info.is_directory)
333 web_file_info->type = WebKit::WebFileInfo::TypeDirectory; 339 web_file_info->type = WebKit::WebFileInfo::TypeDirectory;
334 else 340 else
335 web_file_info->type = WebKit::WebFileInfo::TypeFile; 341 web_file_info->type = WebKit::WebFileInfo::TypeFile;
336 } 342 }
337 343
338 namespace { 344 namespace {
339 345
340 class UserAgentState { 346 class UserAgentState {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 507
502 case WebKit::WebReferrerPolicyAlways: 508 case WebKit::WebReferrerPolicyAlways:
503 case WebKit::WebReferrerPolicyNever: 509 case WebKit::WebReferrerPolicyNever:
504 case WebKit::WebReferrerPolicyOrigin: 510 case WebKit::WebReferrerPolicyOrigin:
505 net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER; 511 net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER;
506 break; 512 break;
507 } 513 }
508 request->set_referrer_policy(net_referrer_policy); 514 request->set_referrer_policy(net_referrer_policy);
509 } 515 }
510 516
517 COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN);
518
511 } // namespace webkit_glue 519 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698