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

Issue 14951007: Refactor BrowserProcessPlatformPart. (Closed)

Created:
7 years, 7 months ago by gab
Modified:
7 years, 7 months ago
CC:
chromium-reviews, nkostylev+watch_chromium.org, sail+watch_chromium.org, Aaron Boodman, rginda+watch_chromium.org, oshima+watch_chromium.org, chromium-apps-reviews_chromium.org, stevenjb+watch_chromium.org, davemoore+watch_chromium.org
Visibility:
Public.

Description

Refactor BrowserProcessPlatformPart. The previous design was to have a class, BrowserProcessPlatformPart, which has various implementations for specific platforms and a common implementation for all other platforms. These implementations (e.g., browser_process_platform_part_(chromeos|aurawin).h) both implement the common methods defined in the common implementation (browser_process_platform_part.h) and some methods specific to their platform. The main problem with this design is that each custom implementation needs to re-implement the default behavior even for the methods for which the base implementation would have been fine (since it's a compile-time choice and doesn't use inheritance). This will become worst as more common methods get added to the base BrowserProcessPlatformPart, forcing every custom implementation to provide a copy of the default implementation for that method... The previous design also forces ugly #if ... #elif ... #elif ... #else ...#endif style of includes just to use the common methods since all headers, but one, are discarded by gyp. This will become worst as more platforms need custom BrowserProcessPlatformPart. Both scenarios making this worst are happening as part of addressing https://codereview.chromium.org/14576015/diff/43017/chrome/browser/lifetime/application_lifetime.cc#newcode116 where adding a common call to BrowserProcessPlatformPart and using it to get rid of the ifdefs there implies one more common call and 2 more platforms. With the new design: There is a common base class which platform-specific implementation override as desired. The #ifdef include-mess is dealt with by having a meta-include in browser_process_platform_part.h which knows which impl to include at compile-time. This is a precursor CL to https://codereview.chromium.org/14576015 BUG=235648, 232842, 179830 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=201028

Patch Set 1 : #

Patch Set 2 : fix compile #

Patch Set 3 : Use BrowserProcessPlatformPartBase instead. #

Total comments: 4

Patch Set 4 : nits #

Patch Set 5 : Simplify TestingBrowserProcessPlatformPart #

Patch Set 6 : include browser_process_platform_part_base.h for typedef case #

Patch Set 7 : always include since fwd-decl conflicts with typedef #

Patch Set 8 : fix includes again #

Patch Set 9 : remove chromeos exclude for testing_browser_process_platform_part #

Patch Set 10 : fix ios? #

Unified diffs Side-by-side diffs Delta from patch set Stats (+91 lines, -175 lines) Patch
M chrome/browser/browser_process.h View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/browser_process_impl.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -8 lines 0 comments Download
M chrome/browser/browser_process_platform_part.h View 1 2 3 4 5 1 chunk +20 lines, -29 lines 0 comments Download
D chrome/browser/browser_process_platform_part.cc View 1 2 1 chunk +0 lines, -18 lines 0 comments Download
M chrome/browser/browser_process_platform_part_aurawin.h View 1 2 3 4 1 chunk +7 lines, -10 lines 0 comments Download
M chrome/browser/browser_process_platform_part_aurawin.cc View 1 2 2 chunks +4 lines, -7 lines 0 comments Download
A + chrome/browser/browser_process_platform_part_base.h View 1 2 2 chunks +9 lines, -7 lines 0 comments Download
A chrome/browser/browser_process_platform_part_base.cc View 1 2 1 chunk +18 lines, -0 lines 0 comments Download
M chrome/browser/browser_process_platform_part_chromeos.h View 1 2 3 4 2 chunks +6 lines, -11 lines 0 comments Download
M chrome/browser/browser_process_platform_part_chromeos.cc View 1 2 2 chunks +4 lines, -8 lines 0 comments Download
M chrome/browser/chrome_browser_main.cc View 2 chunks +1 line, -6 lines 0 comments Download
M chrome/browser/process_singleton_win.cc View 2 chunks +1 line, -6 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 4 chunks +3 lines, -6 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 7 8 2 chunks +0 lines, -6 lines 0 comments Download
M chrome/test/base/testing_browser_process.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M chrome/test/base/testing_browser_process.cc View 1 2 3 4 2 chunks +1 line, -6 lines 0 comments Download
M chrome/test/base/testing_browser_process_platform_part.h View 1 2 3 4 1 chunk +8 lines, -4 lines 0 comments Download
M chrome/test/base/testing_browser_process_platform_part.cc View 1 2 3 4 1 chunk +7 lines, -0 lines 0 comments Download
D chrome/test/base/testing_browser_process_platform_part_chromeos.h View 1 2 3 4 1 chunk +0 lines, -25 lines 0 comments Download
D chrome/test/base/testing_browser_process_platform_part_chromeos.cc View 1 2 3 4 1 chunk +0 lines, -17 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
gab
Scott, PTAL, I feel this refactoring is required to address your comment @https://codereview.chromium.org/14576015/diff/43017/chrome/browser/lifetime/application_lifetime.cc#newcode116 without creating ...
7 years, 7 months ago (2013-05-16 22:53:40 UTC) #1
sky
I agree the current approach is a bit painful. I'm hoping we can avoid yet ...
7 years, 7 months ago (2013-05-16 23:31:55 UTC) #2
gab
I like that, the only problem is it keeps the #if ... #elif ... #elif ...
7 years, 7 months ago (2013-05-17 02:47:42 UTC) #3
gab
PTAL, now using BrowserProcessPlatformPartBase as a base for all impls (and typedefed the base to ...
7 years, 7 months ago (2013-05-17 03:46:20 UTC) #4
sky
I like what you have here. Much cleaner. https://codereview.chromium.org/14951007/diff/14001/chrome/browser/browser_process_platform_part.h File chrome/browser/browser_process_platform_part.h (right): https://codereview.chromium.org/14951007/diff/14001/chrome/browser/browser_process_platform_part.h#newcode16 chrome/browser/browser_process_platform_part.h:16: typedef ...
7 years, 7 months ago (2013-05-17 15:42:33 UTC) #5
gab
PTAL, also fixed TestingBrowserProcessPlatformPart (see issue the previous paradigm created on https://codereview.chromium.org/14698027/). I thought of ...
7 years, 7 months ago (2013-05-17 19:47:00 UTC) #6
sky
LGTM
7 years, 7 months ago (2013-05-17 21:19:05 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/gab@chromium.org/14951007/59001
7 years, 7 months ago (2013-05-17 23:37:31 UTC) #8
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 7 months ago (2013-05-17 23:50:47 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/gab@chromium.org/14951007/70001
7 years, 7 months ago (2013-05-19 00:02:53 UTC) #10
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 7 months ago (2013-05-19 00:18:18 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/gab@chromium.org/14951007/83003
7 years, 7 months ago (2013-05-19 01:22:51 UTC) #12
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 7 months ago (2013-05-19 01:37:41 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/gab@chromium.org/14951007/81004
7 years, 7 months ago (2013-05-19 04:16:14 UTC) #14
commit-bot: I haz the power
7 years, 7 months ago (2013-05-20 05:30:18 UTC) #15
Message was sent while issue was closed.
Change committed as 201028

Powered by Google App Engine
This is Rietveld 408576698