DescriptionRefactor 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? #Messages
Total messages: 15 (0 generated)
|