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

Side by Side Diff: extensions/browser/process_manager.cc

Issue 2689963003: Don't report a keepalive count for persistent pages. (Closed)
Patch Set: Address review comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/browser/process_manager.h" 5 #include "extensions/browser/process_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 const Extension* ProcessManager::GetExtensionForWebContents( 465 const Extension* ProcessManager::GetExtensionForWebContents(
466 const content::WebContents* web_contents) { 466 const content::WebContents* web_contents) {
467 if (!web_contents->GetSiteInstance()) 467 if (!web_contents->GetSiteInstance())
468 return nullptr; 468 return nullptr;
469 return extension_registry_->enabled_extensions().GetByID( 469 return extension_registry_->enabled_extensions().GetByID(
470 GetExtensionIdForSiteInstance(web_contents->GetSiteInstance())); 470 GetExtensionIdForSiteInstance(web_contents->GetSiteInstance()));
471 } 471 }
472 472
473 int ProcessManager::GetLazyKeepaliveCount(const Extension* extension) { 473 int ProcessManager::GetLazyKeepaliveCount(const Extension* extension) {
474 if (!BackgroundInfo::HasLazyBackgroundPage(extension)) 474 if (!BackgroundInfo::HasLazyBackgroundPage(extension))
475 return 0; 475 return -1;
476 476
477 return background_page_data_[extension->id()].lazy_keepalive_count; 477 return background_page_data_[extension->id()].lazy_keepalive_count;
478 } 478 }
479 479
480 void ProcessManager::IncrementLazyKeepaliveCount(const Extension* extension) { 480 void ProcessManager::IncrementLazyKeepaliveCount(const Extension* extension) {
481 if (BackgroundInfo::HasLazyBackgroundPage(extension)) { 481 if (BackgroundInfo::HasLazyBackgroundPage(extension)) {
482 int& count = background_page_data_[extension->id()].lazy_keepalive_count; 482 int& count = background_page_data_[extension->id()].lazy_keepalive_count;
483 if (++count == 1) 483 if (++count == 1)
484 OnLazyBackgroundPageActive(extension->id()); 484 OnLazyBackgroundPageActive(extension->id());
485 } 485 }
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 if (extension && !IncognitoInfo::IsSplitMode(extension)) { 990 if (extension && !IncognitoInfo::IsSplitMode(extension)) {
991 BrowserContext* original_context = 991 BrowserContext* original_context =
992 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context()); 992 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context());
993 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url); 993 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url);
994 } 994 }
995 995
996 return ProcessManager::GetSiteInstanceForURL(url); 996 return ProcessManager::GetSiteInstanceForURL(url);
997 } 997 }
998 998
999 } // namespace extensions 999 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698