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

Unified Diff: base/nix/mime_util_xdg.h

Issue 2168403003: Avoid file IO on UI thread by moving more save-page-as stuff to the FILE thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment tweaks for base::nix::GetFileMimeType + two extra DCHECK_CURRENTLY_ON asserts in SavePackag… Created 4 years, 5 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 | content/browser/download/save_package.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/nix/mime_util_xdg.h
diff --git a/base/nix/mime_util_xdg.h b/base/nix/mime_util_xdg.h
index e40415e1c4800245cc6de8fa4ac41fdde476f987..41bbf6d28881d978c1c00fab03938a428d1cd782 100644
--- a/base/nix/mime_util_xdg.h
+++ b/base/nix/mime_util_xdg.h
@@ -16,9 +16,17 @@ class FilePath;
namespace nix {
-// Gets the mime type for a file based on its filename. The file path does not
-// have to exist. Please note because it doesn't touch the disk, this does not
-// work for directories.
+// Gets the mime type for a file at |filepath|.
+//
+// The mime type is calculated based only on the file name of |filepath|. In
+// particular |filepath| will not be touched on disk and |filepath| doesn't even
+// have to exist. This means that the function does not work for directories
+// (i.e. |filepath| is assumed to be a path to a file).
+//
+// Note that this function might need to read from disk the mime-types data
+// provided by the OS. Therefore this function should not be called from
+// threads that disallow IO via base::ThreadRestrictions::SetIOAllowed(false).
+//
// If the mime type is unknown, this will return application/octet-stream.
BASE_EXPORT std::string GetFileMimeType(const FilePath& filepath);
« no previous file with comments | « no previous file | content/browser/download/save_package.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698