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

Side by Side Diff: extensions/browser/api/runtime/runtime_api.cc

Issue 381283002: Refactor code that defers extension background page loading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: larger DeferLoadingBackgroundHosts Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/api/runtime/runtime_api.h" 5 #include "extensions/browser/api/runtime/runtime_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ExtensionHost* host) { 72 ExtensionHost* host) {
73 // A NULL host from the LazyBackgroundTaskQueue means the page failed to 73 // A NULL host from the LazyBackgroundTaskQueue means the page failed to
74 // load. Give up. 74 // load. Give up.
75 if (!host && !first_call) 75 if (!host && !first_call)
76 return; 76 return;
77 77
78 // Don't send onStartup events to incognito browser contexts. 78 // Don't send onStartup events to incognito browser contexts.
79 if (browser_context->IsOffTheRecord()) 79 if (browser_context->IsOffTheRecord())
80 return; 80 return;
81 81
82 LOG(ERROR) << "JAMES DispatchOnStartupEventImpl IsValidContext "
83 << ExtensionsBrowserClient::Get()->IsValidContext(browser_context);
82 if (ExtensionsBrowserClient::Get()->IsShuttingDown() || 84 if (ExtensionsBrowserClient::Get()->IsShuttingDown() ||
83 !ExtensionsBrowserClient::Get()->IsValidContext(browser_context)) 85 !ExtensionsBrowserClient::Get()->IsValidContext(browser_context))
84 return; 86 return;
85 ExtensionSystem* system = ExtensionSystem::Get(browser_context); 87 ExtensionSystem* system = ExtensionSystem::Get(browser_context);
86 if (!system) 88 if (!system)
87 return; 89 return;
88 90
89 // If this is a persistent background page, we want to wait for it to load 91 // If this is a persistent background page, we want to wait for it to load
90 // (it might not be ready, since this is startup). But only enqueue once. 92 // (it might not be ready, since this is startup). But only enqueue once.
91 // If it fails to load the first time, don't bother trying again. 93 // If it fails to load the first time, don't bother trying again.
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 content::ChildProcessSecurityPolicy* policy = 532 content::ChildProcessSecurityPolicy* policy =
531 content::ChildProcessSecurityPolicy::GetInstance(); 533 content::ChildProcessSecurityPolicy::GetInstance();
532 policy->GrantReadFileSystem(renderer_id, filesystem_id); 534 policy->GrantReadFileSystem(renderer_id, filesystem_id);
533 base::DictionaryValue* dict = new base::DictionaryValue(); 535 base::DictionaryValue* dict = new base::DictionaryValue();
534 dict->SetString("fileSystemId", filesystem_id); 536 dict->SetString("fileSystemId", filesystem_id);
535 dict->SetString("baseName", relative_path); 537 dict->SetString("baseName", relative_path);
536 return RespondNow(OneArgument(dict)); 538 return RespondNow(OneArgument(dict));
537 } 539 }
538 540
539 } // namespace extensions 541 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698