performance_manager_registry.cc 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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. #include "components/performance_manager/embedder/performance_manager_registry.h"
  5. #include "components/performance_manager/performance_manager_registry_impl.h"
  6. #include "components/performance_manager/performance_manager_tab_helper.h"
  7. namespace performance_manager {
  8. // static
  9. std::unique_ptr<PerformanceManagerRegistry>
  10. PerformanceManagerRegistry::Create() {
  11. return std::make_unique<PerformanceManagerRegistryImpl>();
  12. }
  13. // static
  14. PerformanceManagerRegistry* PerformanceManagerRegistry::GetInstance() {
  15. return PerformanceManagerRegistryImpl::GetInstance();
  16. }
  17. void PerformanceManagerRegistry::MaybeCreatePageNodeForWebContents(
  18. content::WebContents* web_contents) {
  19. DCHECK(web_contents);
  20. // Do not attach if we're already attached.
  21. if (PerformanceManagerTabHelper::FromWebContents(web_contents))
  22. return;
  23. CreatePageNodeForWebContents(web_contents);
  24. }
  25. } // namespace performance_manager