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

Issue 343003: Get rid of FilePath::AppendAndResolveRelative().... (Closed)

Created:
11 years, 1 month ago by MAD
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, Aaron Boodman, Erik does not do reviews, pam+watch_chromium.org, brettw+cc_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Get rid of FilePath::AppendAndResolveRelative(). To resolve the problem of '..' parent references as well as symbolic links on POSIX platforms, we can simply use the file_util::AbsolutePath() function. This has the drawback of having a different behavior on Windows and POSIX platforms, in the way that it can return a canonical path that doesn't exists when ran on Windows, but it will return an empty path (or false) when run on a POSIX platform. So we need to add an extra PathExists() call to unify the behavior. BUG=25681, 25131 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=30334

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -193 lines) Patch
M base/file_path.h View 1 1 chunk +0 lines, -12 lines 0 comments Download
M base/file_path.cc View 1 1 chunk +0 lines, -69 lines 0 comments Download
M base/file_path_unittest.cc View 1 1 chunk +0 lines, -92 lines 0 comments Download
M chrome/browser/extensions/extensions_service_unittest.cc View 1 chunk +10 lines, -6 lines 0 comments Download
M chrome/common/extensions/extension_resource.cc View 1 1 chunk +21 lines, -7 lines 0 comments Download
M chrome/common/extensions/extension_resource_unittest.cc View 1 2 chunks +3 lines, -4 lines 0 comments Download
M chrome/test/data/extensions/samples/gmail_browser_action/manifest.json View 1 chunk +0 lines, -3 lines 4 comments Download

Messages

Total messages: 8 (0 generated)
MAD
Could this me the one? :-) Thanks again! BYE MAD
11 years, 1 month ago (2009-10-28 00:02:14 UTC) #1
Mark Mentovai
LG if the try servers like it. You might want to wait for an extensions ...
11 years, 1 month ago (2009-10-28 00:20:47 UTC) #2
MAD
Fixed aa's email which I goofed in the first try... Answered Mark's question... And will ...
11 years, 1 month ago (2009-10-28 03:44:45 UTC) #3
Aaron Boodman
lgtm http://codereview.chromium.org/343003/diff/2001/2008 File chrome/test/data/extensions/samples/gmail_browser_action/manifest.json (left): http://codereview.chromium.org/343003/diff/2001/2008#oldcode13 Line 13: "128": "icon_128.png" On 2009/10/28 03:44:45, mad1 wrote: ...
11 years, 1 month ago (2009-10-28 06:08:18 UTC) #4
MAD
All green... committing... Thanks all... BE:) MAD http://codereview.chromium.org/343003/diff/2001/2008 File chrome/test/data/extensions/samples/gmail_browser_action/manifest.json (left): http://codereview.chromium.org/343003/diff/2001/2008#oldcode13 Line 13: "128": ...
11 years, 1 month ago (2009-10-28 12:40:54 UTC) #5
brettw
It looks like this function (even before this change) did a bunch of file I/O. ...
11 years, 1 month ago (2009-10-28 16:56:22 UTC) #6
MAD
I'll let the extension folks confirm it, but from what I have seen, the reason ...
11 years, 1 month ago (2009-10-28 17:05:56 UTC) #7
MAD
11 years, 1 month ago (2009-10-28 17:07:21 UTC) #8
I replied too quickly, found it... I could add this in
ExtensionResource::GetFilePath() maybe?

  DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));


BYE
MAD

On Wed, Oct 28, 2009 at 1:05 PM, Marc-Andre Decoste <mad@chromium.org>wrote:

> I'll let the extension folks confirm it, but from what I have seen, the
> reason for existence of this object (ExtensionResouce) is to package the
> extension root path and a resource relative path so that they can be sent to
> the IO thread for getting the full path and fetching the resource...
>
> For example, inchrome\browser\extensions\execute_code_in_tab_function.cc
>
>>   scoped_refptr<FileReader> file_reader(new FileReader(
>
>       resource_, NewCallback(this,
>> &ExecuteCodeInTabFunction::DidLoadFile)));
>
>   file_reader->Start();
>
> using chrome\browser\extensions\file_reader.h
>
>> void FileReader::Start() {
>
>   ChromeThread::PostTask(
>
>       ChromeThread::FILE, FROM_HERE,
>
>       NewRunnableMethod(this, &FileReader::ReadFileOnBackgroundThread));
>
> }
>
>
>> void FileReader::ReadFileOnBackgroundThread() {
>
>   std::string data;
>
>   bool success = file_util::ReadFileToString(resource_.GetFilePath(),
>> &data);
>
>   origin_loop_->PostTask(FROM_HERE, NewRunnableMethod(
>
>       this, &FileReader::RunCallback, success, data));
>
> }
>
>
>
> Do we have a way to assert/DCHECK that we are actually running in the
> ChromeThread::FILE thread?
>
> BYE
> MAD
>
>
> On Wed, Oct 28, 2009 at 12:56 PM, <brettw@chromium.org> wrote:
>
>> It looks like this function (even before this change) did a bunch of file
>> I/O.
>>
>> It also looks to me like this is called from the UI thread. Can an
>> extension
>> person clarify how extension loading is done? We really don't want to
>> block the
>> UI thread on this type of thing.
>>
>>
>> http://codereview.chromium.org/343003
>>
>
>

Powered by Google App Engine
This is Rietveld 408576698