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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2929113002: Enable spare RenderProcessHost to be preinitialized. (Closed)
Patch Set: rebase Created 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 void Release(int old_route_id) { 457 void Release(int old_route_id) {
458 session_storage_namespaces_awaiting_close_->erase(old_route_id); 458 session_storage_namespaces_awaiting_close_->erase(old_route_id);
459 } 459 }
460 460
461 private: 461 private:
462 std::unique_ptr<std::map<int, SessionStorageNamespaceMap>> 462 std::unique_ptr<std::map<int, SessionStorageNamespaceMap>>
463 session_storage_namespaces_awaiting_close_; 463 session_storage_namespaces_awaiting_close_;
464 DISALLOW_COPY_AND_ASSIGN(SessionStorageHolder); 464 DISALLOW_COPY_AND_ASSIGN(SessionStorageHolder);
465 }; 465 };
466 466
467 // This class manages spare RenderProcessHosts.
468 //
469 // There is a singleton instance of this class which manages a single spare
470 // renderer (g_spare_render_process_host_manager, below). This class
471 // encapsulates the implementation of
472 // RenderProcessHost::WarmupSpareRenderProcessHost()
473 //
474 // RenderProcessHostImpl should call
475 // SpareRenderProcessHostManager::MaybeTakeSpareRenderProcessHost when creating
476 // a new RPH. In this implementation, the spare renderer is bound to a
477 // BrowserContext and its default StoragePartition. If
478 // MaybeTakeSpareRenderProcessHost is called with a BrowserContext and
479 // StoragePartition that does not match, the spare renderer is discarded. In
480 // particular, only the default StoragePartition will be able to use a spare
481 // renderer. The spare renderer will also not be used as a guest renderer
482 // (is_for_guests_ == true).
483 //
484 // It is safe to call WarmupSpareRenderProcessHost multiple times, although if
485 // called in a context where the spare renderer is not likely to be used
486 // performance may suffer due to the unnecessary RPH creation.
487 class SpareRenderProcessHostManager : public RenderProcessHostObserver {
488 public:
489 SpareRenderProcessHostManager() {}
490
491 void WarmupSpareRenderProcessHost(BrowserContext* browser_context) {
492 StoragePartitionImpl* current_partition =
493 static_cast<StoragePartitionImpl*>(
494 BrowserContext::GetStoragePartition(browser_context, nullptr));
495
496 if (spare_render_process_host_ &&
497 matching_browser_context_ == browser_context &&
498 matching_storage_partition_ == current_partition)
499 return; // Nothing to warm up.
500
501 CleanupSpareRenderProcessHost();
502
503 // Don't create a spare renderer if we're using --single-process or if we've
504 // got too many processes. See also ShouldTryToUseExistingProcessHost in
505 // this file.
506 if (RenderProcessHost::run_renderer_in_process() ||
507 g_all_hosts.Get().size() >=
508 RenderProcessHostImpl::GetMaxRendererProcessCount())
509 return;
510
511 matching_browser_context_ = browser_context;
512 matching_storage_partition_ = current_partition;
513
514 spare_render_process_host_ = RenderProcessHostImpl::CreateRenderProcessHost(
515 browser_context, current_partition, false /* is_for_guests_only */);
516 spare_render_process_host_->AddObserver(this);
517 spare_render_process_host_->Init();
518 }
519
520 RenderProcessHost* MaybeTakeSpareRenderProcessHost(
521 const BrowserContext* browser_context,
522 const StoragePartition* partition,
523 bool is_for_guests_only) {
524 if (!spare_render_process_host_ ||
525 browser_context != matching_browser_context_ ||
526 partition != matching_storage_partition_ || is_for_guests_only) {
527 // As a new RenderProcessHost will almost certainly be created, we cleanup
528 // the non-matching one so as not to waste resources.
529 CleanupSpareRenderProcessHost();
530 return nullptr;
531 }
532
533 CHECK(static_cast<RenderProcessHostImpl*>(spare_render_process_host_)
534 ->HostHasNotBeenUsed());
535 RenderProcessHost* rph = spare_render_process_host_;
536 DropSpareRenderProcessHost(spare_render_process_host_);
537 return rph;
538 }
539
540 // Remove |host| as a possible spare renderer. Does not shut it down cleanly;
541 // the assumption is that the host was shutdown somewhere else and has
542 // notifying the SpareRenderProcessHostManager.
543 void DropSpareRenderProcessHost(RenderProcessHost* host) {
544 if (spare_render_process_host_ && spare_render_process_host_ == host) {
545 spare_render_process_host_->RemoveObserver(this);
546 spare_render_process_host_ = nullptr;
547 }
548 }
549
550 // Remove |host| as a possible spare renderer. If |host| is not the spare
551 // renderer, then shut down the spare renderer. The idea is that a navigation
552 // was just made to |host|, and we do not expect another immediate navigation,
553 // so that the spare renderer can be dropped in order to free up resources.
554 void DropSpareOnProcessCreation(RenderProcessHost* new_host) {
555 if (spare_render_process_host_ == new_host) {
556 DropSpareRenderProcessHost(new_host);
557 } else {
558 CleanupSpareRenderProcessHost();
559 }
560 }
561
562 // Gracefully remove and cleanup a spare RenderProcessHost if it exists.
563 void CleanupSpareRenderProcessHost() {
564 if (spare_render_process_host_) {
565 spare_render_process_host_->Cleanup();
566 DropSpareRenderProcessHost(spare_render_process_host_);
567 }
568 }
569
570 RenderProcessHost* spare_render_process_host() {
571 return spare_render_process_host_;
572 }
573
574 private:
575 // RenderProcessHostObserver
576 void RenderProcessWillExit(RenderProcessHost* host) override {
577 DropSpareRenderProcessHost(host);
578 }
579
580 void RenderProcessExited(RenderProcessHost* host,
581 base::TerminationStatus unused_status,
582 int unused_exit_code) override {
583 DropSpareRenderProcessHost(host);
584 }
585
586 void RenderProcessHostDestroyed(RenderProcessHost* host) override {
587 DropSpareRenderProcessHost(host);
588 }
589
590 // This is a bare pointer, because RenderProcessHost manages the lifetime of
591 // all its instances; see g_all_hosts, above.
592 RenderProcessHost* spare_render_process_host_;
593
594 // Used only to check if a creation request matches the spare, and not
595 // accessed.
596 const BrowserContext* matching_browser_context_ = nullptr;
597 const StoragePartition* matching_storage_partition_ = nullptr;
598
599 DISALLOW_COPY_AND_ASSIGN(SpareRenderProcessHostManager);
600 };
601
602 base::LazyInstance<SpareRenderProcessHostManager>::Leaky
603 g_spare_render_process_host_manager = LAZY_INSTANCE_INITIALIZER;
604
467 const void* const kDefaultSubframeProcessHostHolderKey = 605 const void* const kDefaultSubframeProcessHostHolderKey =
468 &kDefaultSubframeProcessHostHolderKey; 606 &kDefaultSubframeProcessHostHolderKey;
469 607
470 class DefaultSubframeProcessHostHolder : public base::SupportsUserData::Data, 608 class DefaultSubframeProcessHostHolder : public base::SupportsUserData::Data,
471 public RenderProcessHostObserver { 609 public RenderProcessHostObserver {
472 public: 610 public:
473 explicit DefaultSubframeProcessHostHolder(BrowserContext* browser_context) 611 explicit DefaultSubframeProcessHostHolder(BrowserContext* browser_context)
474 : browser_context_(browser_context) {} 612 : browser_context_(browser_context) {}
475 ~DefaultSubframeProcessHostHolder() override {} 613 ~DefaultSubframeProcessHostHolder() override {}
476 614
477 // Gets the correct render process to use for this SiteInstance. 615 // Gets the correct render process to use for this SiteInstance.
478 RenderProcessHost* GetProcessHost(SiteInstance* site_instance, 616 RenderProcessHost* GetProcessHost(SiteInstance* site_instance,
479 bool is_for_guests_only) { 617 bool is_for_guests_only) {
480 StoragePartition* default_partition = 618 StoragePartitionImpl* default_partition =
481 BrowserContext::GetDefaultStoragePartition(browser_context_); 619 static_cast<StoragePartitionImpl*>(
482 StoragePartition* partition = 620 BrowserContext::GetDefaultStoragePartition(browser_context_));
483 BrowserContext::GetStoragePartition(browser_context_, site_instance); 621 StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
622 BrowserContext::GetStoragePartition(browser_context_, site_instance));
484 623
485 // Is this the default storage partition? If it isn't, then just give it its 624 // Is this the default storage partition? If it isn't, then just give it its
486 // own non-shared process. 625 // own non-shared process.
487 if (partition != default_partition || is_for_guests_only) { 626 if (partition != default_partition || is_for_guests_only) {
488 RenderProcessHostImpl* host = new RenderProcessHostImpl( 627 RenderProcessHost* host = RenderProcessHostImpl::CreateRenderProcessHost(
489 browser_context_, static_cast<StoragePartitionImpl*>(partition), 628 browser_context_, partition, is_for_guests_only);
490 is_for_guests_only);
491 host->SetIsNeverSuitableForReuse(); 629 host->SetIsNeverSuitableForReuse();
492 return host; 630 return host;
493 } 631 }
494 632
495 // If we already have a shared host for the default storage partition, use 633 // If we already have a shared host for the default storage partition, use
496 // it. 634 // it.
497 if (host_) 635 if (host_)
498 return host_; 636 return host_;
499 637
500 host_ = new RenderProcessHostImpl( 638 host_ = RenderProcessHostImpl::CreateOrUseSpareRenderProcessHost(
501 browser_context_, static_cast<StoragePartitionImpl*>(partition), 639 browser_context_, partition, false /* is for guests only */);
502 false /* for guests only */);
503 host_->SetIsNeverSuitableForReuse(); 640 host_->SetIsNeverSuitableForReuse();
504 host_->AddObserver(this); 641 host_->AddObserver(this);
505 642
506 return host_; 643 return host_;
507 } 644 }
508 645
509 // Implementation of RenderProcessHostObserver. 646 // Implementation of RenderProcessHostObserver.
510 void RenderProcessHostDestroyed(RenderProcessHost* host) override { 647 void RenderProcessHostDestroyed(RenderProcessHost* host) override {
511 DCHECK_EQ(host_, host); 648 DCHECK_EQ(host_, host);
512 host_->RemoveObserver(this); 649 host_->RemoveObserver(this);
513 host_ = nullptr; 650 host_ = nullptr;
514 } 651 }
515 652
516 private: 653 private:
517 BrowserContext* browser_context_; 654 BrowserContext* browser_context_;
518 655
519 // The default subframe render process used for the default storage partition 656 // The default subframe render process used for the default storage partition
520 // of this BrowserContext. 657 // of this BrowserContext.
521 RenderProcessHostImpl* host_ = nullptr; 658 RenderProcessHost* host_ = nullptr;
522 }; 659 };
523 660
524 void CreateMemoryCoordinatorHandle( 661 void CreateMemoryCoordinatorHandle(
525 int render_process_id, 662 int render_process_id,
526 const service_manager::BindSourceInfo& source_info, 663 const service_manager::BindSourceInfo& source_info,
527 mojom::MemoryCoordinatorHandleRequest request) { 664 mojom::MemoryCoordinatorHandleRequest request) {
528 MemoryCoordinatorImpl::GetInstance()->CreateHandle(render_process_id, 665 MemoryCoordinatorImpl::GetInstance()->CreateHandle(render_process_id,
529 std::move(request)); 666 std::move(request));
530 } 667 }
531 668
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 max_count = std::min(max_count, kMaxRendererProcessCount); 1168 max_count = std::min(max_count, kMaxRendererProcessCount);
1032 } 1169 }
1033 return max_count; 1170 return max_count;
1034 } 1171 }
1035 1172
1036 // static 1173 // static
1037 void RenderProcessHost::SetMaxRendererProcessCount(size_t count) { 1174 void RenderProcessHost::SetMaxRendererProcessCount(size_t count) {
1038 g_max_renderer_count_override = count; 1175 g_max_renderer_count_override = count;
1039 } 1176 }
1040 1177
1178 // static
1179 RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost(
1180 BrowserContext* browser_context,
1181 StoragePartitionImpl* storage_partition_impl,
1182 bool is_for_guests_only) {
1183 if (g_render_process_host_factory_) {
1184 return g_render_process_host_factory_->CreateRenderProcessHost(
1185 browser_context);
1186 }
1187
1188 return new RenderProcessHostImpl(browser_context, storage_partition_impl,
1189 is_for_guests_only);
1190 }
1191
1192 // static
1193 RenderProcessHost* RenderProcessHostImpl::CreateOrUseSpareRenderProcessHost(
1194 BrowserContext* browser_context,
1195 StoragePartitionImpl* storage_partition_impl,
1196 bool is_for_guests_only) {
1197 RenderProcessHost* render_process_host =
1198 g_spare_render_process_host_manager.Get().MaybeTakeSpareRenderProcessHost(
1199 browser_context, storage_partition_impl, is_for_guests_only);
1200
1201 if (!render_process_host) {
1202 render_process_host = CreateRenderProcessHost(
1203 browser_context, storage_partition_impl, is_for_guests_only);
1204 }
1205
1206 DCHECK(render_process_host);
1207 return render_process_host;
1208 }
1209
1041 RenderProcessHostImpl::RenderProcessHostImpl( 1210 RenderProcessHostImpl::RenderProcessHostImpl(
1042 BrowserContext* browser_context, 1211 BrowserContext* browser_context,
1043 StoragePartitionImpl* storage_partition_impl, 1212 StoragePartitionImpl* storage_partition_impl,
1044 bool is_for_guests_only) 1213 bool is_for_guests_only)
1045 : fast_shutdown_started_(false), 1214 : fast_shutdown_started_(false),
1046 deleting_soon_(false), 1215 deleting_soon_(false),
1047 #ifndef NDEBUG 1216 #ifndef NDEBUG
1048 is_self_deleted_(false), 1217 is_self_deleted_(false),
1049 #endif 1218 #endif
1050 pending_views_(0), 1219 pending_views_(0),
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 } 2058 }
1890 2059
1891 void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() { 2060 void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() {
1892 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2061 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1893 DCHECK(!is_worker_ref_count_disabled_); 2062 DCHECK(!is_worker_ref_count_disabled_);
1894 is_worker_ref_count_disabled_ = true; 2063 is_worker_ref_count_disabled_ = true;
1895 if (!GetWorkerRefCount()) 2064 if (!GetWorkerRefCount())
1896 return; 2065 return;
1897 service_worker_ref_count_ = 0; 2066 service_worker_ref_count_ = 0;
1898 shared_worker_ref_count_ = 0; 2067 shared_worker_ref_count_ = 0;
2068 // Cleaning up will also remove this from the SpareRenderProcessHostManager.
1899 Cleanup(); 2069 Cleanup();
1900 } 2070 }
1901 2071
1902 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { 2072 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() {
1903 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2073 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1904 return is_worker_ref_count_disabled_; 2074 return is_worker_ref_count_disabled_;
1905 } 2075 }
1906 2076
1907 void RenderProcessHostImpl::PurgeAndSuspend() { 2077 void RenderProcessHostImpl::PurgeAndSuspend() {
1908 Send(new ChildProcessMsg_PurgeAndSuspend()); 2078 Send(new ChildProcessMsg_PurgeAndSuspend());
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 SiteProcessCountTracker* tracker = static_cast<SiteProcessCountTracker*>( 2290 SiteProcessCountTracker* tracker = static_cast<SiteProcessCountTracker*>(
2121 browser_context->GetUserData(kPendingSiteProcessCountTrackerKey)); 2291 browser_context->GetUserData(kPendingSiteProcessCountTrackerKey));
2122 if (!tracker) { 2292 if (!tracker) {
2123 tracker = new SiteProcessCountTracker(); 2293 tracker = new SiteProcessCountTracker();
2124 browser_context->SetUserData(kPendingSiteProcessCountTrackerKey, 2294 browser_context->SetUserData(kPendingSiteProcessCountTrackerKey,
2125 base::WrapUnique(tracker)); 2295 base::WrapUnique(tracker));
2126 } 2296 }
2127 tracker->DecrementSiteProcessCount(site_url, render_process_host->GetID()); 2297 tracker->DecrementSiteProcessCount(site_url, render_process_host->GetID());
2128 } 2298 }
2129 2299
2300 // static
2301 void RenderProcessHostImpl::CleanupSpareRenderProcessHost() {
2302 g_spare_render_process_host_manager.Get().CleanupSpareRenderProcessHost();
2303 }
2304
2305 // static
2306 RenderProcessHost*
2307 RenderProcessHostImpl::GetSpareRenderProcessHostForTesting() {
2308 return g_spare_render_process_host_manager.Get().spare_render_process_host();
2309 }
2310
2311 bool RenderProcessHostImpl::HostHasNotBeenUsed() {
2312 return IsUnused() && listeners_.IsEmpty() && GetWorkerRefCount() == 0 &&
2313 pending_views_ == 0;
2314 }
2315
2130 bool RenderProcessHostImpl::IsForGuestsOnly() const { 2316 bool RenderProcessHostImpl::IsForGuestsOnly() const {
2131 return is_for_guests_only_; 2317 return is_for_guests_only_;
2132 } 2318 }
2133 2319
2134 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const { 2320 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const {
2135 return storage_partition_impl_; 2321 return storage_partition_impl_;
2136 } 2322 }
2137 2323
2138 static void AppendCompositorCommandLineFlags(base::CommandLine* command_line) { 2324 static void AppendCompositorCommandLineFlags(base::CommandLine* command_line) {
2139 command_line->AppendSwitchASCII( 2325 command_line->AppendSwitchASCII(
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
3065 // Otherwise, if this process has been used to host any other content, it 3251 // Otherwise, if this process has been used to host any other content, it
3066 // cannot be reused if the destination site indeed requires a dedicated 3252 // cannot be reused if the destination site indeed requires a dedicated
3067 // process and can be locked to just that site. 3253 // process and can be locked to just that site.
3068 return false; 3254 return false;
3069 } 3255 }
3070 3256
3071 return GetContentClient()->browser()->IsSuitableHost(host, site_url); 3257 return GetContentClient()->browser()->IsSuitableHost(host, site_url);
3072 } 3258 }
3073 3259
3074 // static 3260 // static
3261 void RenderProcessHost::WarmupSpareRenderProcessHost(
3262 content::BrowserContext* browser_context) {
3263 g_spare_render_process_host_manager.Get().WarmupSpareRenderProcessHost(
3264 browser_context);
3265 }
3266
3267 // static
3075 bool RenderProcessHost::run_renderer_in_process() { 3268 bool RenderProcessHost::run_renderer_in_process() {
3076 return g_run_renderer_in_process_; 3269 return g_run_renderer_in_process_;
3077 } 3270 }
3078 3271
3079 // static 3272 // static
3080 void RenderProcessHost::SetRunRendererInProcess(bool value) { 3273 void RenderProcessHost::SetRunRendererInProcess(bool value) {
3081 g_run_renderer_in_process_ = value; 3274 g_run_renderer_in_process_ = value;
3082 3275
3083 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 3276 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
3084 if (value) { 3277 if (value) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3142 browser_context, site_url)) { 3335 browser_context, site_url)) {
3143 suitable_renderers.push_back(iter.GetCurrentValue()); 3336 suitable_renderers.push_back(iter.GetCurrentValue());
3144 } 3337 }
3145 iter.Advance(); 3338 iter.Advance();
3146 } 3339 }
3147 3340
3148 // Now pick a random suitable renderer, if we have any. 3341 // Now pick a random suitable renderer, if we have any.
3149 if (!suitable_renderers.empty()) { 3342 if (!suitable_renderers.empty()) {
3150 int suitable_count = static_cast<int>(suitable_renderers.size()); 3343 int suitable_count = static_cast<int>(suitable_renderers.size());
3151 int random_index = base::RandInt(0, suitable_count - 1); 3344 int random_index = base::RandInt(0, suitable_count - 1);
3345 // If the process chosen was the spare RenderProcessHost, ensure it won't be
3346 // used as a spare in the future, or drop the spare if it wasn't used.
3347 g_spare_render_process_host_manager.Get().DropSpareOnProcessCreation(
3348 suitable_renderers[random_index]);
3152 return suitable_renderers[random_index]; 3349 return suitable_renderers[random_index];
3153 } 3350 }
3154 3351
3155 return NULL; 3352 return NULL;
3156 } 3353 }
3157 3354
3158 // static 3355 // static
3159 bool RenderProcessHost::ShouldUseProcessPerSite(BrowserContext* browser_context, 3356 bool RenderProcessHost::ShouldUseProcessPerSite(BrowserContext* browser_context,
3160 const GURL& url) { 3357 const GURL& url) {
3161 // Returns true if we should use the process-per-site model. This will be 3358 // Returns true if we should use the process-per-site model. This will be
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
3268 render_process_host = UnmatchedServiceWorkerProcessTracker::MatchWithSite( 3465 render_process_host = UnmatchedServiceWorkerProcessTracker::MatchWithSite(
3269 browser_context, site_url); 3466 browser_context, site_url);
3270 } 3467 }
3271 3468
3272 // If not (or if none found), see if we should reuse an existing process. 3469 // If not (or if none found), see if we should reuse an existing process.
3273 if (!render_process_host && 3470 if (!render_process_host &&
3274 ShouldTryToUseExistingProcessHost(browser_context, site_url)) { 3471 ShouldTryToUseExistingProcessHost(browser_context, site_url)) {
3275 render_process_host = GetExistingProcessHost(browser_context, site_url); 3472 render_process_host = GetExistingProcessHost(browser_context, site_url);
3276 } 3473 }
3277 3474
3278 // Otherwise (or if that fails), create a new one. 3475 // Otherwise, use the spare RenderProcessHost or create a new one.
3279 if (!render_process_host) { 3476 if (!render_process_host) {
3280 if (g_render_process_host_factory_) { 3477 StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
3281 render_process_host = 3478 BrowserContext::GetStoragePartition(browser_context, site_instance));
3282 g_render_process_host_factory_->CreateRenderProcessHost( 3479 render_process_host = CreateOrUseSpareRenderProcessHost(
3283 browser_context); 3480 browser_context, partition, is_for_guests_only);
3284 } else {
3285 StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
3286 BrowserContext::GetStoragePartition(browser_context, site_instance));
3287 render_process_host = new RenderProcessHostImpl(
3288 browser_context, partition, is_for_guests_only);
3289 }
3290 } 3481 }
3291 3482
3292 if (is_unmatched_service_worker) { 3483 if (is_unmatched_service_worker) {
3293 UnmatchedServiceWorkerProcessTracker::Register( 3484 UnmatchedServiceWorkerProcessTracker::Register(
3294 browser_context, render_process_host, site_url); 3485 browser_context, render_process_host, site_url);
3295 } 3486 }
3296 return render_process_host; 3487 return render_process_host;
3297 } 3488 }
3298 3489
3299 void RenderProcessHostImpl::CreateSharedRendererHistogramAllocator() { 3490 void RenderProcessHostImpl::CreateSharedRendererHistogramAllocator() {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
3795 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3986 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3796 3987
3797 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. 3988 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing.
3798 // Capture the error message in a crash key value. 3989 // Capture the error message in a crash key value.
3799 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); 3990 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error);
3800 bad_message::ReceivedBadMessage(render_process_id, 3991 bad_message::ReceivedBadMessage(render_process_id,
3801 bad_message::RPH_MOJO_PROCESS_ERROR); 3992 bad_message::RPH_MOJO_PROCESS_ERROR);
3802 } 3993 }
3803 3994
3804 } // namespace content 3995 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698