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

Side by Side Diff: chrome/renderer/extensions/extension_dispatcher.cc

Issue 8343079: Don't close background pages if there is a pending response (callback). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 1 month 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/renderer/extensions/extension_dispatcher.h" 5 #include "chrome/renderer/extensions/extension_dispatcher.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/child_process_logging.h" 8 #include "chrome/common/child_process_logging.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 v8_context_set_.DispatchChromeHiddenMethod( 147 v8_context_set_.DispatchChromeHiddenMethod(
148 extension_id, function_name, args, NULL, event_url); 148 extension_id, function_name, args, NULL, event_url);
149 149
150 // Reset the idle handler each time there's any activity like event or message 150 // Reset the idle handler each time there's any activity like event or message
151 // dispatch, for which Invoke is the chokepoint. 151 // dispatch, for which Invoke is the chokepoint.
152 if (is_extension_process_) { 152 if (is_extension_process_) {
153 RenderThread::Get()->ScheduleIdleHandler( 153 RenderThread::Get()->ScheduleIdleHandler(
154 kInitialExtensionIdleHandlerDelayS); 154 kInitialExtensionIdleHandlerDelayS);
155 } 155 }
156 156
157 // Tell the browser process that we're idle. 157 // Tell the browser process that the event is dispatched and we're idle.
158 if (CommandLine::ForCurrentProcess()->HasSwitch( 158 if (CommandLine::ForCurrentProcess()->HasSwitch(
159 switches::kEnableLazyBackgroundPages) && 159 switches::kEnableLazyBackgroundPages) &&
160 function_name == "Event.dispatchJSON") // may always be true 160 function_name == "Event.dispatchJSON") { // may always be true
161 RenderThread::Get()->Send(
162 new ExtensionHostMsg_ExtensionEventAck(extension_id));
163 CheckIdleStatus(extension_id);
164 }
165 }
166
167 void ExtensionDispatcher::CheckIdleStatus(const std::string& extension_id) {
168 if (!ExtensionProcessBindings::HasPendingRequests(extension_id))
161 RenderThread::Get()->Send(new ExtensionHostMsg_ExtensionIdle(extension_id)); 169 RenderThread::Get()->Send(new ExtensionHostMsg_ExtensionIdle(extension_id));
162 } 170 }
163 171
164 void ExtensionDispatcher::OnDeliverMessage(int target_port_id, 172 void ExtensionDispatcher::OnDeliverMessage(int target_port_id,
165 const std::string& message) { 173 const std::string& message) {
166 RendererExtensionBindings::DeliverMessage( 174 RendererExtensionBindings::DeliverMessage(
167 v8_context_set_.GetAll(), 175 v8_context_set_.GetAll(),
168 target_port_id, 176 target_port_id,
169 message, 177 message,
170 NULL); // All render views. 178 NULL); // All render views.
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 407
400 RenderThread::Get()->RegisterExtension(extension); 408 RenderThread::Get()->RegisterExtension(extension);
401 } 409 }
402 410
403 void ExtensionDispatcher::OnUsingWebRequestAPI( 411 void ExtensionDispatcher::OnUsingWebRequestAPI(
404 bool adblock, bool adblock_plus, bool other) { 412 bool adblock, bool adblock_plus, bool other) {
405 webrequest_adblock_ = adblock; 413 webrequest_adblock_ = adblock;
406 webrequest_adblock_plus_ = adblock_plus; 414 webrequest_adblock_plus_ = adblock_plus;
407 webrequest_other_ = other; 415 webrequest_other_ = other;
408 } 416 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_dispatcher.h ('k') | chrome/renderer/extensions/extension_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698