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

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
« no previous file with comments | « extensions/browser/process_manager.h ('k') | extensions/shell/app/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 502 }
503 } 503 }
504 504
505 if (!keepalive_impulse_callback_for_testing_.is_null()) { 505 if (!keepalive_impulse_callback_for_testing_.is_null()) {
506 ImpulseCallbackForTesting callback_may_clear_callbacks_reentrantly = 506 ImpulseCallbackForTesting callback_may_clear_callbacks_reentrantly =
507 keepalive_impulse_callback_for_testing_; 507 keepalive_impulse_callback_for_testing_;
508 callback_may_clear_callbacks_reentrantly.Run(extension->id()); 508 callback_may_clear_callbacks_reentrantly.Run(extension->id());
509 } 509 }
510 } 510 }
511 511
512 // static
513 void ProcessManager::OnKeepaliveFromPlugin(int render_process_id,
514 int render_frame_id,
515 const std::string& extension_id) {
516 content::RenderFrameHost* render_frame_host =
517 content::RenderFrameHost::FromID(render_process_id, render_frame_id);
518 if (!render_frame_host)
519 return;
520
521 content::SiteInstance* site_instance = render_frame_host->GetSiteInstance();
522 if (!site_instance)
523 return;
524
525 BrowserContext* browser_context = site_instance->GetBrowserContext();
526 const Extension* extension =
527 ExtensionRegistry::Get(browser_context)->enabled_extensions().GetByID(
528 extension_id);
529 if (!extension)
530 return;
531
532 ProcessManager* pm = ExtensionSystem::Get(browser_context)->process_manager();
533 if (!pm)
534 return;
535
536 pm->KeepaliveImpulse(extension);
537 }
538
512 // DecrementLazyKeepaliveCount is called when no calls to KeepaliveImpulse 539 // DecrementLazyKeepaliveCount is called when no calls to KeepaliveImpulse
513 // have been made for at least event_page_idle_time_. In the best case an 540 // have been made for at least event_page_idle_time_. In the best case an
514 // impulse was made just before being cleared, and the decrement will occur 541 // impulse was made just before being cleared, and the decrement will occur
515 // event_page_idle_time_ later, causing a 2 * event_page_idle_time_ total time 542 // event_page_idle_time_ later, causing a 2 * event_page_idle_time_ total time
516 // for extension to be shut down based on impulses. Worst case is an impulse 543 // for extension to be shut down based on impulses. Worst case is an impulse
517 // just after a clear, adding one check cycle and resulting in 3x total time. 544 // just after a clear, adding one check cycle and resulting in 3x total time.
518 void ProcessManager::OnKeepaliveImpulseCheck() { 545 void ProcessManager::OnKeepaliveImpulseCheck() {
519 for (BackgroundPageDataMap::iterator i = background_page_data_.begin(); 546 for (BackgroundPageDataMap::iterator i = background_page_data_.begin();
520 i != background_page_data_.end(); 547 i != background_page_data_.end();
521 ++i) { 548 ++i) {
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 SiteInstance* IncognitoProcessManager::GetSiteInstanceForURL(const GURL& url) { 948 SiteInstance* IncognitoProcessManager::GetSiteInstanceForURL(const GURL& url) {
922 const Extension* extension = 949 const Extension* extension =
923 extension_registry_->enabled_extensions().GetExtensionOrAppByURL(url); 950 extension_registry_->enabled_extensions().GetExtensionOrAppByURL(url);
924 if (extension && !IncognitoInfo::IsSplitMode(extension)) 951 if (extension && !IncognitoInfo::IsSplitMode(extension))
925 return original_manager_->GetSiteInstanceForURL(url); 952 return original_manager_->GetSiteInstanceForURL(url);
926 953
927 return ProcessManager::GetSiteInstanceForURL(url); 954 return ProcessManager::GetSiteInstanceForURL(url);
928 } 955 }
929 956
930 } // namespace extensions 957 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/process_manager.h ('k') | extensions/shell/app/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698