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

Issue 10911261: chromeos: Stop calling ProfileManager::GetDefaultProfile() from extension event dispatch functions (Closed)

Created:
8 years, 3 months ago by hashimoto
Modified:
8 years, 3 months ago
CC:
chromium-reviews, mihaip-chromium-reviews_chromium.org, sadrul, nkostylev+watch_chromium.org, ben+watch_chromium.org, Aaron Boodman, oshima+watch_chromium.org, stevenjb+watch_chromium.org, davemoore+watch_chromium.org
Visibility:
Public.

Description

chromeos: Stop calling ProfileManager::GetDefaultProfile() from extension event dispatch functions During login, GetDefaultProfile() changes the profile which it returns from the one for the login screen to the one which is used for the user browsing session. The problem is that GetDefaultProfile() starts to return the new profile before it gets ready to be used. It means using GetDefaultProfile() for events which can happen during login may result in crash. To avoid this, observers remember the profile which they should use instead of calling GetDefaultProfile() every time. By doing this, they never access the not-ready profile and the profile switching is safely performed by ChromeBrowserMainPartsChromeos::PostProfileInit which is called for the new profile. BUG=148552 TEST=Boot a Chromebook, type the password for a user, start pressing brightness up/down key randomly, press Enter to login while keeping pressing brightness keys, ensure no crash report is sent during login.

Patch Set 1 #

Total comments: 2

Patch Set 2 : Added function comments #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+94 lines, -38 lines) Patch
M chrome/browser/chromeos/chrome_browser_main_chromeos.cc View 1 chunk +3 lines, -3 lines 3 comments Download
M chrome/browser/chromeos/power/brightness_observer.h View 2 chunks +5 lines, -1 line 0 comments Download
M chrome/browser/chromeos/power/brightness_observer.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/power/resume_observer.h View 2 chunks +5 lines, -1 line 0 comments Download
M chrome/browser/chromeos/power/resume_observer.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/power/screen_lock_observer.h View 2 chunks +5 lines, -1 line 0 comments Download
M chrome/browser/chromeos/power/screen_lock_observer.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/system/ash_system_tray_delegate.cc View 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/extensions/system/system_api.h View 1 1 chunk +19 lines, -4 lines 0 comments Download
M chrome/browser/extensions/system/system_api.cc View 3 chunks +22 lines, -12 lines 0 comments Download
M chrome/browser/ui/ash/volume_controller_chromeos.cc View 5 chunks +25 lines, -8 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
hashimoto
satorux, You might be somehow familiar with this code. Could you review this change?
8 years, 3 months ago (2012-09-12 19:53:45 UTC) #1
satorux1
http://codereview.chromium.org/10911261/diff/1/chrome/browser/extensions/system/system_api.h File chrome/browser/extensions/system/system_api.h (right): http://codereview.chromium.org/10911261/diff/1/chrome/browser/extensions/system/system_api.h#newcode45 chrome/browser/extensions/system/system_api.h:45: void DispatchWokeUpEvent(Profile* profile); While you are at it. Could ...
8 years, 3 months ago (2012-09-12 20:33:23 UTC) #2
hashimoto
http://codereview.chromium.org/10911261/diff/1/chrome/browser/extensions/system/system_api.h File chrome/browser/extensions/system/system_api.h (right): http://codereview.chromium.org/10911261/diff/1/chrome/browser/extensions/system/system_api.h#newcode45 chrome/browser/extensions/system/system_api.h:45: void DispatchWokeUpEvent(Profile* profile); On 2012/09/12 20:33:23, satorux1 wrote: > ...
8 years, 3 months ago (2012-09-12 20:42:50 UTC) #3
hashimoto
ping? On 2012/09/12 20:42:50, hashimoto wrote: > http://codereview.chromium.org/10911261/diff/1/chrome/browser/extensions/system/system_api.h > File chrome/browser/extensions/system/system_api.h (right): > > http://codereview.chromium.org/10911261/diff/1/chrome/browser/extensions/system/system_api.h#newcode45 ...
8 years, 3 months ago (2012-09-12 23:38:04 UTC) #4
satorux1
I'm confused about "GetDefaultProfile() may return a profile before it gets ready to be used." ...
8 years, 3 months ago (2012-09-12 23:51:00 UTC) #5
hashimoto
The following events happen during login. (1) Before login, ProfileManager::GetDefaultProfile() returns a profile which is ...
8 years, 3 months ago (2012-09-13 00:08:21 UTC) #6
satorux1
On 2012/09/13 00:08:21, hashimoto wrote: > The following events happen during login. > > (1) ...
8 years, 3 months ago (2012-09-13 00:18:17 UTC) #7
hashimoto
On 2012/09/13 00:18:17, satorux1 wrote: > On 2012/09/13 00:08:21, hashimoto wrote: > > The following ...
8 years, 3 months ago (2012-09-13 00:24:43 UTC) #8
satorux1
On 2012/09/13 00:24:43, hashimoto wrote: > On 2012/09/13 00:18:17, satorux1 wrote: > > On 2012/09/13 ...
8 years, 3 months ago (2012-09-13 00:40:21 UTC) #9
satorux1
http://codereview.chromium.org/10911261/diff/4002/chrome/browser/chromeos/chrome_browser_main_chromeos.cc File chrome/browser/chromeos/chrome_browser_main_chromeos.cc (right): http://codereview.chromium.org/10911261/diff/4002/chrome/browser/chromeos/chrome_browser_main_chromeos.cc#newcode460 chrome/browser/chromeos/chrome_browser_main_chromeos.cc:460: brightness_observer_.reset(new chromeos::BrightnessObserver(profile())); Please write some comment about why these ...
8 years, 3 months ago (2012-09-13 00:42:56 UTC) #10
hashimoto
Updated the change description. http://codereview.chromium.org/10911261/diff/4002/chrome/browser/chromeos/chrome_browser_main_chromeos.cc File chrome/browser/chromeos/chrome_browser_main_chromeos.cc (right): http://codereview.chromium.org/10911261/diff/4002/chrome/browser/chromeos/chrome_browser_main_chromeos.cc#newcode460 chrome/browser/chromeos/chrome_browser_main_chromeos.cc:460: brightness_observer_.reset(new chromeos::BrightnessObserver(profile())); On 2012/09/13 00:42:56, ...
8 years, 3 months ago (2012-09-13 01:01:39 UTC) #11
satorux1
LGTM for fixing this bug now. However, per the following description: "The problem is that ...
8 years, 3 months ago (2012-09-13 01:13:46 UTC) #12
hashimoto
On 2012/09/13 01:13:46, satorux1 wrote: > LGTM for fixing this bug now. > > However, ...
8 years, 3 months ago (2012-09-13 04:06:19 UTC) #13
Mihai Parparita -not on Chrome
I'm pretty sure the most correct fix is to use EventRouterForwarder, which doesn't require a ...
8 years, 3 months ago (2012-09-13 04:15:38 UTC) #14
hashimoto
On 2012/09/13 04:15:38, Mihai Parparita wrote: > I'm pretty sure the most correct fix is ...
8 years, 3 months ago (2012-09-13 19:50:32 UTC) #15
satorux1
Yes, that was a great suggestion. I'm just wondering how you magically appeared to the ...
8 years, 3 months ago (2012-09-13 19:53:21 UTC) #16
Mihai Parparita -not on Chrome
8 years, 3 months ago (2012-09-13 19:54:02 UTC) #17
On Thu, Sep 13, 2012 at 12:53 PM, <satorux@chromium.org> wrote:

> Yes, that was a great suggestion. I'm just wondering how you magically
> appeared
> to the code review. :)
>

I'm auto-cced for all extensions-related code reviews.

Mihai

Powered by Google App Engine
This is Rietveld 408576698