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

Side by Side Diff: chrome/browser/extensions/extension_message_service.cc

Issue 10626007: Move ExtensionSystem into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Master merge; moved class declaration Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/extensions/extension_message_service.h" 5 #include "chrome/browser/extensions/extension_message_service.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return NULL; 132 return NULL;
133 133
134 return site_instance->GetProcess(); 134 return site_instance->GetProcess();
135 } 135 }
136 136
137 static void IncrementLazyKeepaliveCount( 137 static void IncrementLazyKeepaliveCount(
138 ExtensionMessageService::MessagePort* port) { 138 ExtensionMessageService::MessagePort* port) {
139 Profile* profile = 139 Profile* profile =
140 Profile::FromBrowserContext(port->process->GetBrowserContext()); 140 Profile::FromBrowserContext(port->process->GetBrowserContext());
141 ExtensionProcessManager* pm = 141 ExtensionProcessManager* pm =
142 ExtensionSystem::Get(profile)->process_manager(); 142 extensions::ExtensionSystem::Get(profile)->process_manager();
143 ExtensionHost* host = pm->GetBackgroundHostForExtension(port->extension_id); 143 ExtensionHost* host = pm->GetBackgroundHostForExtension(port->extension_id);
144 if (host && host->extension()->has_lazy_background_page()) 144 if (host && host->extension()->has_lazy_background_page())
145 pm->IncrementLazyKeepaliveCount(host->extension()); 145 pm->IncrementLazyKeepaliveCount(host->extension());
146 146
147 // Keep track of the background host, so when we decrement, we only do so if 147 // Keep track of the background host, so when we decrement, we only do so if
148 // the host hasn't reloaded. 148 // the host hasn't reloaded.
149 port->background_host_ptr = host; 149 port->background_host_ptr = host;
150 } 150 }
151 151
152 static void DecrementLazyKeepaliveCount( 152 static void DecrementLazyKeepaliveCount(
153 ExtensionMessageService::MessagePort* port) { 153 ExtensionMessageService::MessagePort* port) {
154 Profile* profile = 154 Profile* profile =
155 Profile::FromBrowserContext(port->process->GetBrowserContext()); 155 Profile::FromBrowserContext(port->process->GetBrowserContext());
156 ExtensionProcessManager* pm = 156 ExtensionProcessManager* pm =
157 ExtensionSystem::Get(profile)->process_manager(); 157 extensions::ExtensionSystem::Get(profile)->process_manager();
158 ExtensionHost* host = pm->GetBackgroundHostForExtension(port->extension_id); 158 ExtensionHost* host = pm->GetBackgroundHostForExtension(port->extension_id);
159 if (host && host == port->background_host_ptr) 159 if (host && host == port->background_host_ptr)
160 pm->DecrementLazyKeepaliveCount(host->extension()); 160 pm->DecrementLazyKeepaliveCount(host->extension());
161 } 161 }
162 162
163 } // namespace 163 } // namespace
164 164
165 // static 165 // static
166 void ExtensionMessageService::AllocatePortIdPair(int* port1, int* port2) { 166 void ExtensionMessageService::AllocatePortIdPair(int* port1, int* port2) {
167 int channel_id = g_next_channel_id.GetNext(); 167 int channel_id = g_next_channel_id.GetNext();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 OpenChannelParams params = params_in; 463 OpenChannelParams params = params_in;
464 params.source = content::RenderProcessHost::FromID(source_process_id); 464 params.source = content::RenderProcessHost::FromID(source_process_id);
465 if (!params.source) 465 if (!params.source)
466 return; 466 return;
467 467
468 params.receiver = MessagePort(host->render_process_host(), 468 params.receiver = MessagePort(host->render_process_host(),
469 MSG_ROUTING_CONTROL, 469 MSG_ROUTING_CONTROL,
470 params.target_extension_id); 470 params.target_extension_id);
471 OpenChannelImpl(params); 471 OpenChannelImpl(params);
472 } 472 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_message_handler.cc ('k') | chrome/browser/extensions/extension_process_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698