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

Side by Side 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, 4 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
« no previous file with comments | « no previous file | content/browser/download/save_package.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_NIX_MIME_UTIL_XDG_H_ 5 #ifndef BASE_NIX_MIME_UTIL_XDG_H_
6 #define BASE_NIX_MIME_UTIL_XDG_H_ 6 #define BASE_NIX_MIME_UTIL_XDG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 12
13 namespace base { 13 namespace base {
14 14
15 class FilePath; 15 class FilePath;
16 16
17 namespace nix { 17 namespace nix {
18 18
19 // Gets the mime type for a file based on its filename. The file path does not 19 // Gets the mime type for a file at |filepath|.
20 // have to exist. Please note because it doesn't touch the disk, this does not 20 //
21 // work for directories. 21 // The mime type is calculated based only on the file name of |filepath|. In
22 // particular |filepath| will not be touched on disk and |filepath| doesn't even
23 // have to exist. This means that the function does not work for directories
24 // (i.e. |filepath| is assumed to be a path to a file).
25 //
26 // Note that this function might need to read from disk the mime-types data
27 // provided by the OS. Therefore this function should not be called from
28 // threads that disallow IO via base::ThreadRestrictions::SetIOAllowed(false).
29 //
22 // If the mime type is unknown, this will return application/octet-stream. 30 // If the mime type is unknown, this will return application/octet-stream.
23 BASE_EXPORT std::string GetFileMimeType(const FilePath& filepath); 31 BASE_EXPORT std::string GetFileMimeType(const FilePath& filepath);
24 32
25 // Get the mime type for a byte vector. 33 // Get the mime type for a byte vector.
26 BASE_EXPORT std::string GetDataMimeType(const std::string& data); 34 BASE_EXPORT std::string GetDataMimeType(const std::string& data);
27 35
28 } // namespace nix 36 } // namespace nix
29 } // namespace base 37 } // namespace base
30 38
31 #endif // BASE_NIX_MIME_UTIL_XDG_H_ 39 #endif // BASE_NIX_MIME_UTIL_XDG_H_
OLDNEW
« 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