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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webkit_glue.cc
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index 2477e230942784d465b3a93494d3aeb78be216e8..41d62e4d535cdc1f68c9f46c9ae3b79ba9c810c6 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -11,6 +11,8 @@
#include <sys/utsname.h>
#endif
+#include <limits>
+
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -327,7 +329,11 @@ void PlatformFileInfoToWebFileInfo(
const base::PlatformFileInfo& file_info,
WebKit::WebFileInfo* web_file_info) {
DCHECK(web_file_info);
- web_file_info->modificationTime = file_info.last_modified.ToDoubleT();
+ // WebKit now expects NaN as uninitialized/null Date.
+ if (file_info.last_modified.is_null())
+ web_file_info->modificationTime = std::numeric_limits<double>::quiet_NaN();
+ else
+ web_file_info->modificationTime = file_info.last_modified.ToDoubleT();
web_file_info->length = file_info.size;
if (file_info.is_directory)
web_file_info->type = WebKit::WebFileInfo::TypeDirectory;
@@ -508,4 +514,6 @@ void ConfigureURLRequestForReferrerPolicy(
request->set_referrer_policy(net_referrer_policy);
}
+COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN);
+
} // namespace webkit_glue
« 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