// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/child/file_info_util.h"

#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebFileInfo.h"

namespace content {

void FileInfoToWebFileInfo(const base::File::Info& file_info,
                           blink::WebFileInfo* web_file_info) {
  DCHECK(web_file_info);
  // Blink 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.ToJsTime();
  web_file_info->length = file_info.size;
  if (file_info.is_directory)
    web_file_info->type = blink::WebFileInfo::TypeDirectory;
  else
    web_file_info->type = blink::WebFileInfo::TypeFile;
}

static_assert(std::numeric_limits<double>::has_quiet_NaN,
              "should have quiet NaN");

}  // namespace content

// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/child/file_info_util.h"

#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebFileInfo.h"

namespace content {

void FileInfoToWebFileInfo(const base::File::Info& file_info,
                           blink::WebFileInfo* web_file_info) {
  DCHECK(web_file_info);
  // Blink now expects NaN as uninitialized/null Date.
  if (file_info.last_modified.is_null()) {
    web_file_info->modificationTime = std::numeric_limits<double>::quiet_NaN();
    web_file_info->modificationTimeMS =
        std::numeric_limits<double>::quiet_NaN();
  } else {
    web_file_info->modificationTime = file_info.last_modified.ToJsTime();
    web_file_info->modificationTimeMS = file_info.last_modified.ToJsTime();
  }
  web_file_info->length = file_info.size;
  if (file_info.is_directory)
    web_file_info->type = blink::WebFileInfo::TypeDirectory;
  else
    web_file_info->type = blink::WebFileInfo::TypeFile;
}

static_assert(std::numeric_limits<double>::has_quiet_NaN,
              "should have quiet NaN");

}  // namespace content

--- 
+++ 
@@ -13,14 +13,10 @@
                            blink::WebFileInfo* web_file_info) {
   DCHECK(web_file_info);
   // Blink now expects NaN as uninitialized/null Date.
-  if (file_info.last_modified.is_null()) {
+  if (file_info.last_modified.is_null())
     web_file_info->modificationTime = std::numeric_limits<double>::quiet_NaN();
-    web_file_info->modificationTimeMS =
-        std::numeric_limits<double>::quiet_NaN();
-  } else {
+  else
     web_file_info->modificationTime = file_info.last_modified.ToJsTime();
-    web_file_info->modificationTimeMS = file_info.last_modified.ToJsTime();
-  }
   web_file_info->length = file_info.size;
   if (file_info.is_directory)
     web_file_info->type = blink::WebFileInfo::TypeDirectory;
Upgrade Blink to milliseconds-based last modified filetimes, part 6.

Have content::FileInfoToWebFileInfo() no longer fill in
WebFileInfo::modificationTimeMS; it is now unused by Blink.

Once landed, this lets Blink remove the WebFileInfo field entirely.

This is part 6 in the following patch series,

1: [blink] add WebFileInfo::modificationTimeMS [ https://codereview.chromium.org/873723004/ ]
2: [chromium] fill in modificationTimeMS [ https://codereview.chromium.org/884413002/ ]
3: [blink] make use of modificationTimeMS [ https://codereview.chromium.org/884393002/ ]
4: [chromium] set modificationTime to something msec-based [ https://codereview.chromium.org/862203003/ ]
5: [blink] switch to modificationTime [ https://codereview.chromium.org/882343002/ ]
6: [chromium] *this one* [ https://codereview.chromium.org/890523002/ ]
7: [blink] remove modificationTimeMS [ https://codereview.chromium.org/869613005/ ]

R=jochen
BUG=451747

Review URL: https://codereview.chromium.org/890523002

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#315545}
