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

Side by Side Diff: content/browser/site_instance_impl.cc

Issue 2422923002: Reduce usage of FOR_EACH_OBSERVER macro in content/browser (Closed)
Patch Set: skip cases in 2418143004 and 2418373002 Created 4 years, 2 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 "content/browser/site_instance_impl.h" 5 #include "content/browser/site_instance_impl.h"
6 6
7 #include "content/browser/browsing_instance.h" 7 #include "content/browser/browsing_instance.h"
8 #include "content/browser/child_process_security_policy_impl.h" 8 #include "content/browser/child_process_security_policy_impl.h"
9 #include "content/browser/frame_host/debug_urls.h" 9 #include "content/browser/frame_host/debug_urls.h"
10 #include "content/browser/frame_host/frame_tree_node.h" 10 #include "content/browser/frame_host/frame_tree_node.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return false; 237 return false;
238 238
239 return DoesSiteRequireDedicatedProcess(GetBrowserContext(), site_); 239 return DoesSiteRequireDedicatedProcess(GetBrowserContext(), site_);
240 } 240 }
241 241
242 void SiteInstanceImpl::IncrementActiveFrameCount() { 242 void SiteInstanceImpl::IncrementActiveFrameCount() {
243 active_frame_count_++; 243 active_frame_count_++;
244 } 244 }
245 245
246 void SiteInstanceImpl::DecrementActiveFrameCount() { 246 void SiteInstanceImpl::DecrementActiveFrameCount() {
247 if (--active_frame_count_ == 0) 247 if (--active_frame_count_ == 0) {
248 FOR_EACH_OBSERVER(Observer, observers_, ActiveFrameCountIsZero(this)); 248 for (auto& observer : observers_)
249 observer.ActiveFrameCountIsZero(this);
250 }
249 } 251 }
250 252
251 void SiteInstanceImpl::IncrementRelatedActiveContentsCount() { 253 void SiteInstanceImpl::IncrementRelatedActiveContentsCount() {
252 browsing_instance_->increment_active_contents_count(); 254 browsing_instance_->increment_active_contents_count();
253 } 255 }
254 256
255 void SiteInstanceImpl::DecrementRelatedActiveContentsCount() { 257 void SiteInstanceImpl::DecrementRelatedActiveContentsCount() {
256 browsing_instance_->decrement_active_contents_count(); 258 browsing_instance_->decrement_active_contents_count();
257 } 259 }
258 260
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 390
389 void SiteInstanceImpl::RenderProcessHostDestroyed(RenderProcessHost* host) { 391 void SiteInstanceImpl::RenderProcessHostDestroyed(RenderProcessHost* host) {
390 DCHECK_EQ(process_, host); 392 DCHECK_EQ(process_, host);
391 process_->RemoveObserver(this); 393 process_->RemoveObserver(this);
392 process_ = nullptr; 394 process_ = nullptr;
393 } 395 }
394 396
395 void SiteInstanceImpl::RenderProcessWillExit(RenderProcessHost* host) { 397 void SiteInstanceImpl::RenderProcessWillExit(RenderProcessHost* host) {
396 // TODO(nick): http://crbug.com/575400 - RenderProcessWillExit might not serve 398 // TODO(nick): http://crbug.com/575400 - RenderProcessWillExit might not serve
397 // any purpose here. 399 // any purpose here.
398 FOR_EACH_OBSERVER(Observer, observers_, RenderProcessGone(this)); 400 for (auto& observer : observers_)
401 observer.RenderProcessGone(this);
399 } 402 }
400 403
401 void SiteInstanceImpl::RenderProcessExited(RenderProcessHost* host, 404 void SiteInstanceImpl::RenderProcessExited(RenderProcessHost* host,
402 base::TerminationStatus status, 405 base::TerminationStatus status,
403 int exit_code) { 406 int exit_code) {
404 FOR_EACH_OBSERVER(Observer, observers_, RenderProcessGone(this)); 407 for (auto& observer : observers_)
408 observer.RenderProcessGone(this);
405 } 409 }
406 410
407 void SiteInstanceImpl::LockToOrigin() { 411 void SiteInstanceImpl::LockToOrigin() {
408 // TODO(nick): When all sites are isolated, this operation provides strong 412 // TODO(nick): When all sites are isolated, this operation provides strong
409 // protection. If only some sites are isolated, we need additional logic to 413 // protection. If only some sites are isolated, we need additional logic to
410 // prevent the non-isolated sites from requesting resources for isolated 414 // prevent the non-isolated sites from requesting resources for isolated
411 // sites. https://crbug.com/509125 415 // sites. https://crbug.com/509125
412 if (RequiresDedicatedProcess()) { 416 if (RequiresDedicatedProcess()) {
413 // Guest processes cannot be locked to its site because guests always have 417 // Guest processes cannot be locked to its site because guests always have
414 // a fixed SiteInstance. The site of GURLs a guest loads doesn't match that 418 // a fixed SiteInstance. The site of GURLs a guest loads doesn't match that
(...skipping 17 matching lines...) Expand all
432 browsing_instance_->browser_context(), site_)) 436 browsing_instance_->browser_context(), site_))
433 return; 437 return;
434 438
435 ChildProcessSecurityPolicyImpl* policy = 439 ChildProcessSecurityPolicyImpl* policy =
436 ChildProcessSecurityPolicyImpl::GetInstance(); 440 ChildProcessSecurityPolicyImpl::GetInstance();
437 policy->LockToOrigin(process_->GetID(), site_); 441 policy->LockToOrigin(process_->GetID(), site_);
438 } 442 }
439 } 443 }
440 444
441 } // namespace content 445 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/shared_worker/shared_worker_service_impl.cc ('k') | content/browser/tracing/tracing_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698