Base: Don't check for thread restrictions when closing a file doesn't do IO.

Also, clarify the File API a little more.

BUG=322664
R=thakis@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252585 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 48abb285fb4cd2c8fab6d01f26bb78700404a01f
diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc
index a37de53..a62ad98 100644
--- a/base/files/file_posix.cc
+++ b/base/files/file_posix.cc
@@ -217,10 +217,10 @@
 }
 
 void File::Close() {
-  base::ThreadRestrictions::AssertIOAllowed();
   if (!IsValid())
     return;
 
+  base::ThreadRestrictions::AssertIOAllowed();
   if (!IGNORE_EINTR(close(file_)))
     file_ = kInvalidPlatformFileValue;
 }