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

Issue 1068793002: Fixed "blocking io" from FixupPath on UI thread. (Closed)

Created:
5 years, 8 months ago by eugenebng
Modified:
5 years, 7 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, erikwright+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fixed "blocking io" from FixupURL on UI thread. FixupURL calls FixupPath who then calls FilePathToFileURL, in which adding current directory in specific cases (details below) was removed. That caused DCHECK because getting cwd is protected with AssertIOAlolowed. Code being removed was reachable from autocomlete, which resulted in DCHECK. So it was responsible for some "functionallity", but not useful. I examined, which functionality we will lose: specific paths like "c:", "с::foo", "c:foo" are recognized as not absolute paths on Windows and cwd is added. What happens for those URLs: AutocompleteInput::Parse calls FixupURL, in there SegmentURLInternal recognizes them as having file scheme on Windows at the same time segmenting to parts is not successful (url::Parsed is not valid). This functionality is only reachable on Windows and it is not useful, because those paths with ":" are not valid relative paths on Windows. For example, autocomlete result like file:///C:/Users/me/chromium/src/out/Debug/C: (cwd added before C:) isn't useful. For other paths of that style cwd-adding code was not called: "file://c:", "file://./foo" are segmented successfully by SegmentURLInternal, so, no current dirrectory adding here. "c:/foo", "c:\foo" - are recognoized as absolute paths, no CWD added "./foo.txt", "foo.txt" "foo\foo.txt" - not recognized as having "file" scheme, no CWD added. ~/directory_or_file URLs - don't need CWD. Regarding existing functionality working with relative paths: GetURLsFromCommandLine and ProfileImpl::GetHomePage that can get relative path(or homepage URL) from command line both use not FixupURL, FixupRelativeFile function. FilePathToFileURL is documented in it's comment as taking absolute path as argument. Also FixupURL (which indirectly calls FilePathToFileURL), by it's name and description, is not intended to fixup relative file paths. Not to mention, resolving relative paths to absolute via FixupURL is broken. Regarding client code that could use functionality being removed in this fix. Adding cwd was introduced in commit 0135aa172211433181e1cdaf009ff77716e87ff7 https://codereview.chromium.org/137233006 that time FilePathToFileURL was in net_util.cc. Client code mentioned there is content_shell Code working with startup URL from there: src\content\shell\browser\shell_browser_main_parts.cc(75): return net::FilePathToFileURL(base::FilePath(args[0])); Now this code is not included in project (don't know why). This particular client code needs CWD adding, it was fixed to use right function for adding cwd. R=davidben@chromium.org,pkasting@chromium.org,alekseys@chromium.org,gunsch@chromium.org BUG=60641 TEST=entering "c:" url will not cause debug version to fail on DCHECK on Windows, and launching content_shell with argument like foo.html (this html shouldexist in current diroctory) results in foo.html contents shown in content_shell and absolute path to foo.html displayed in addres bar. Committed: https://crrev.com/b9400dc444da523c1dc1484f8e2adb0637804410 Cr-Commit-Position: refs/heads/master@{#327263}

Patch Set 1 #

Patch Set 2 : Fixed "blocking io" from FixupURL on UI thread #

Total comments: 3

Patch Set 3 : Fixed "blocking IO" from FixupURL on UI thread #

Patch Set 4 : Fixed adding cwd aka "blocking IO" used in FixupURL via FilePathToFileURL, also fixed client code t… #

Total comments: 3

Patch Set 5 : Fixed adding cwd aka "blocking IO" used in FixupURL via FilePathToFileURL, also fixed client code #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -9 lines) Patch
M chrome/browser/printing/print_preview_pdf_generated_browsertest.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chromecast/browser/service/cast_service_simple.cc View 1 2 3 4 2 chunks +3 lines, -1 line 2 comments Download
M content/shell/browser/shell_browser_main_parts.cc View 1 2 3 4 2 chunks +3 lines, -1 line 1 comment Download
M net/base/filename_util.cc View 1 2 1 chunk +0 lines, -6 lines 0 comments Download

Messages

Total messages: 30 (4 generated)
eugenebng
5 years, 8 months ago (2015-04-07 10:52:03 UTC) #1
davidben
not lgtm. I don't think this change is correct. Even with a lock, GetCurrentDirectoryThreadSafe isn't ...
5 years, 8 months ago (2015-04-07 18:11:36 UTC) #2
eugenebng
Thanks for your review. I've uploaded another patch set and changed description.
5 years, 8 months ago (2015-04-14 11:06:51 UTC) #4
davidben
> So, while AssertIOAlolowed in Get\SetCurrentDirectory is doubtful, it prevents race by allowing Get\Set current ...
5 years, 8 months ago (2015-04-14 16:26:22 UTC) #5
Peter Kasting
On 2015/04/14 16:26:22, David Benjamin wrote: > I don't think splitting that function is the ...
5 years, 8 months ago (2015-04-14 20:46:09 UTC) #6
eugenebng
On 2015/04/14 20:46:09, Peter Kasting wrote: > On 2015/04/14 16:26:22, David Benjamin wrote: > > ...
5 years, 8 months ago (2015-04-20 14:28:38 UTC) #7
eugenebng
On 2015/04/20 14:28:38, eugenebng wrote: > On 2015/04/14 20:46:09, Peter Kasting wrote: > > On ...
5 years, 8 months ago (2015-04-20 15:02:20 UTC) #8
Peter Kasting
I'm not totally clear from your description, but it seems like removing this re-breaks bug ...
5 years, 8 months ago (2015-04-20 22:06:56 UTC) #9
eugenebng
On 2015/04/20 22:06:56, Peter Kasting wrote: > I'm not totally clear from your description, but ...
5 years, 8 months ago (2015-04-21 21:31:47 UTC) #10
Peter Kasting
LGTM https://codereview.chromium.org/1068793002/diff/60001/content/shell/browser/shell_browser_main_parts.cc File content/shell/browser/shell_browser_main_parts.cc (right): https://codereview.chromium.org/1068793002/diff/60001/content/shell/browser/shell_browser_main_parts.cc#newcode69 content/shell/browser/shell_browser_main_parts.cc:69: base::MakeAbsoluteFilePath(base::FilePath(args[0]))); Nit: This would probably be safer as: ...
5 years, 8 months ago (2015-04-21 22:34:05 UTC) #11
davidben
I looked through git log -SFilePathToFileURL from when this behavior was added to now. Most ...
5 years, 8 months ago (2015-04-22 01:09:18 UTC) #12
eugenebng
On 2015/04/22 01:09:18, David Benjamin (OOO sick) wrote: > I looked through git log -SFilePathToFileURL ...
5 years, 8 months ago (2015-04-22 21:02:25 UTC) #14
Aleksey Shlyapnikov
lgtm
5 years, 8 months ago (2015-04-22 22:34:19 UTC) #15
Peter Kasting
Thanks for fixing these other locations. https://codereview.chromium.org/1068793002/diff/80001/chromecast/browser/service/cast_service_simple.cc File chromecast/browser/service/cast_service_simple.cc (right): https://codereview.chromium.org/1068793002/diff/80001/chromecast/browser/service/cast_service_simple.cc#newcode30 chromecast/browser/service/cast_service_simple.cc:30: return net::FilePathToFileURL( Both ...
5 years, 8 months ago (2015-04-22 22:40:04 UTC) #16
eugenebng
Regarding code: > base::FilePath file_path(base::MakeAbsoluteFilePath(base::FilePath(args[0]))); > return file_path.empty() ? GURL() : net::FilePathToFileURL(file_path); I used FilePathToFileURL(base::MakeAbsoluteFilePath(...)) ...
5 years, 8 months ago (2015-04-23 12:01:52 UTC) #17
davidben
lgtm
5 years, 8 months ago (2015-04-23 17:51:07 UTC) #18
Peter Kasting
On 2015/04/23 12:01:52, eugenebng wrote: > Regarding code: > > base::FilePath file_path(base::MakeAbsoluteFilePath(base::FilePath(args[0]))); > > return ...
5 years, 8 months ago (2015-04-23 22:46:07 UTC) #19
gunsch
sorry, just noticed this: chromecast/ lgtm
5 years, 7 months ago (2015-04-28 04:32:06 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1068793002/80001
5 years, 7 months ago (2015-04-28 10:20:46 UTC) #23
commit-bot: I haz the power
Committed patchset #5 (id:80001)
5 years, 7 months ago (2015-04-28 11:18:17 UTC) #24
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/b9400dc444da523c1dc1484f8e2adb0637804410 Cr-Commit-Position: refs/heads/master@{#327263}
5 years, 7 months ago (2015-04-28 11:19:12 UTC) #25
eugenebng
On 2015/04/23 22:46:07, Peter Kasting wrote: > On 2015/04/23 12:01:52, eugenebng wrote: > > Regarding ...
5 years, 7 months ago (2015-04-28 13:23:02 UTC) #26
Peter Kasting
On 2015/04/28 13:23:02, eugenebng wrote: > FilePathToFileURL returns non-empty URL (file:///) when called with empty ...
5 years, 7 months ago (2015-04-28 20:47:15 UTC) #27
eugenebng
On 2015/04/28 20:47:15, Peter Kasting wrote: > On 2015/04/28 13:23:02, eugenebng wrote: > > FilePathToFileURL ...
5 years, 7 months ago (2015-04-29 15:11:49 UTC) #28
eugenebng
found a copy of the code changed in this issue here: /src/mojo/util/filename_util.cc and h. Deosn't ...
5 years, 7 months ago (2015-05-13 12:36:21 UTC) #29
Peter Kasting
5 years, 7 months ago (2015-05-13 22:58:15 UTC) #30
Message was sent while issue was closed.
On 2015/05/13 12:36:21, eugenebng wrote:
> found a copy of the code changed in this issue here:
> /src/mojo/util/filename_util.cc and h. Deosn't it look like I shod submit the
> same change (remove adding CWD in FilePathTofileURL) there too?

I would assume so?

Powered by Google App Engine
This is Rietveld 408576698