browser_main_parts_impl.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef WEBLAYER_BROWSER_BROWSER_MAIN_PARTS_IMPL_H_
  5. #define WEBLAYER_BROWSER_BROWSER_MAIN_PARTS_IMPL_H_
  6. #include <memory>
  7. #include "base/memory/raw_ptr.h"
  8. #include "base/metrics/field_trial.h"
  9. #include "build/build_config.h"
  10. #include "components/embedder_support/android/metrics/memory_metrics_logger.h"
  11. #include "content/public/browser/browser_main_parts.h"
  12. #include "content/public/common/main_function_params.h"
  13. class PrefService;
  14. namespace performance_manager {
  15. class PerformanceManagerLifetime;
  16. }
  17. #if BUILDFLAG(IS_ANDROID)
  18. namespace crash_reporter {
  19. class ChildExitObserver;
  20. }
  21. #endif
  22. namespace weblayer {
  23. class BrowserProcess;
  24. struct MainParams;
  25. class BrowserMainPartsImpl : public content::BrowserMainParts {
  26. public:
  27. BrowserMainPartsImpl(MainParams* params,
  28. std::unique_ptr<PrefService> local_state);
  29. BrowserMainPartsImpl(const BrowserMainPartsImpl&) = delete;
  30. BrowserMainPartsImpl& operator=(const BrowserMainPartsImpl&) = delete;
  31. ~BrowserMainPartsImpl() override;
  32. // BrowserMainParts overrides.
  33. int PreCreateThreads() override;
  34. int PreEarlyInitialization() override;
  35. void PostCreateThreads() override;
  36. int PreMainMessageLoopRun() override;
  37. void WillRunMainMessageLoop(
  38. std::unique_ptr<base::RunLoop>& run_loop) override;
  39. void OnFirstIdle() override;
  40. void PostMainMessageLoopRun() override;
  41. private:
  42. raw_ptr<MainParams> params_;
  43. std::unique_ptr<BrowserProcess> browser_process_;
  44. std::unique_ptr<performance_manager::PerformanceManagerLifetime>
  45. performance_manager_lifetime_;
  46. #if BUILDFLAG(IS_ANDROID)
  47. std::unique_ptr<metrics::MemoryMetricsLogger> memory_metrics_logger_;
  48. std::unique_ptr<crash_reporter::ChildExitObserver> child_exit_observer_;
  49. #endif // BUILDFLAG(IS_ANDROID)
  50. // Ownership of this moves to BrowserProcess. See
  51. // ContentBrowserClientImpl::local_state_ for details.
  52. std::unique_ptr<PrefService> local_state_;
  53. };
  54. } // namespace weblayer
  55. #endif // WEBLAYER_BROWSER_BROWSER_MAIN_PARTS_IMPL_H_