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

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

Issue 437503004: Add NaCl support to app_shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (nacl-init) rebase Created 6 years, 4 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 | Annotate | Revision Log
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } 499 }
500 } 500 }
501 501
502 if (!keepalive_impulse_callback_for_testing_.is_null()) { 502 if (!keepalive_impulse_callback_for_testing_.is_null()) {
503 ImpulseCallbackForTesting callback_may_clear_callbacks_reentrantly = 503 ImpulseCallbackForTesting callback_may_clear_callbacks_reentrantly =
504 keepalive_impulse_callback_for_testing_; 504 keepalive_impulse_callback_for_testing_;
505 callback_may_clear_callbacks_reentrantly.Run(extension->id()); 505 callback_may_clear_callbacks_reentrantly.Run(extension->id());
506 } 506 }
507 } 507 }
508 508
509 // static
510 void ProcessManager::OnKeepaliveFromPlugin(int render_process_id,
511 int render_frame_id,
512 const std::string& extension_id) {
513 content::RenderFrameHost* render_frame_host =
514 content::RenderFrameHost::FromID(render_process_id, render_frame_id);
515 if (!render_frame_host)
516 return;
517
518 content::SiteInstance* site_instance = render_frame_host->GetSiteInstance();
519 if (!site_instance)
520 return;
521
522 BrowserContext* browser_context = site_instance->GetBrowserContext();
523 const Extension* extension =
524 ExtensionRegistry::Get(browser_context)->enabled_extensions().GetByID(
525 extension_id);
526 if (!extension)
527 return;
528
529 ProcessManager* pm = ExtensionSystem::Get(browser_context)->process_manager();
530 if (!pm)
531 return;
532
533 pm->KeepaliveImpulse(extension);
534 }
535
509 // DecrementLazyKeepaliveCount is called when no calls to KeepaliveImpulse 536 // DecrementLazyKeepaliveCount is called when no calls to KeepaliveImpulse
510 // have been made for at least event_page_idle_time_. In the best case an 537 // have been made for at least event_page_idle_time_. In the best case an
511 // impulse was made just before being cleared, and the decrement will occur 538 // impulse was made just before being cleared, and the decrement will occur
512 // event_page_idle_time_ later, causing a 2 * event_page_idle_time_ total time 539 // event_page_idle_time_ later, causing a 2 * event_page_idle_time_ total time
513 // for extension to be shut down based on impulses. Worst case is an impulse 540 // for extension to be shut down based on impulses. Worst case is an impulse
514 // just after a clear, adding one check cycle and resulting in 3x total time. 541 // just after a clear, adding one check cycle and resulting in 3x total time.
515 void ProcessManager::OnKeepaliveImpulseCheck() { 542 void ProcessManager::OnKeepaliveImpulseCheck() {
516 for (BackgroundPageDataMap::iterator i = background_page_data_.begin(); 543 for (BackgroundPageDataMap::iterator i = background_page_data_.begin();
517 i != background_page_data_.end(); 544 i != background_page_data_.end();
518 ++i) { 545 ++i) {
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 SiteInstance* IncognitoProcessManager::GetSiteInstanceForURL(const GURL& url) { 945 SiteInstance* IncognitoProcessManager::GetSiteInstanceForURL(const GURL& url) {
919 const Extension* extension = 946 const Extension* extension =
920 extension_registry_->enabled_extensions().GetExtensionOrAppByURL(url); 947 extension_registry_->enabled_extensions().GetExtensionOrAppByURL(url);
921 if (extension && !IncognitoInfo::IsSplitMode(extension)) 948 if (extension && !IncognitoInfo::IsSplitMode(extension))
922 return original_manager_->GetSiteInstanceForURL(url); 949 return original_manager_->GetSiteInstanceForURL(url);
923 950
924 return ProcessManager::GetSiteInstanceForURL(url); 951 return ProcessManager::GetSiteInstanceForURL(url);
925 } 952 }
926 953
927 } // namespace extensions 954 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698