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

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

Issue 2528233003: Defend against RPHI::ForceReleaseWorkerRefCount called twice.
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1392 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1393 DCHECK(!is_worker_ref_count_disabled_); 1393 DCHECK(!is_worker_ref_count_disabled_);
1394 DCHECK_GT(worker_ref_count(), 0U); 1394 DCHECK_GT(worker_ref_count(), 0U);
1395 --shared_worker_ref_count_; 1395 --shared_worker_ref_count_;
1396 if (worker_ref_count() == 0) 1396 if (worker_ref_count() == 0)
1397 Cleanup(); 1397 Cleanup();
1398 } 1398 }
1399 1399
1400 void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() { 1400 void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() {
1401 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1401 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1402 DCHECK(!is_worker_ref_count_disabled_); 1402 // ForceReleaseWorkerRefCounts can possibly be called twice if a new
1403 // BrowserContext is created at the same address as an one that was just
1404 // destroyed, and the new one is also soon destroyed.
1405 // https://crbug.com/661843.
horo 2016/11/28 07:26:51 I think we should introduce RenderProcessHostImpl:
falken 2016/11/28 07:34:21 Hm, I considered this (see CL description) but Cle
horo 2016/11/28 08:54:40 After BrowserContext::NotifyWillBeDestroyed() is c
falken 2016/11/29 04:19:36 Hm yea I'm no longer sure of either solution. //co
1406 if (is_worker_ref_count_disabled_)
1407 return;
1403 is_worker_ref_count_disabled_ = true; 1408 is_worker_ref_count_disabled_ = true;
1404 if (!worker_ref_count()) 1409 if (!worker_ref_count())
1405 return; 1410 return;
1406 service_worker_ref_count_ = 0; 1411 service_worker_ref_count_ = 0;
1407 shared_worker_ref_count_ = 0; 1412 shared_worker_ref_count_ = 0;
1408 Cleanup(); 1413 Cleanup();
1409 } 1414 }
1410 1415
1411 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { 1416 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() {
1412 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1417 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2999 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3004 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3000 3005
3001 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 3006 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
3002 // enough information here so that we can determine what the bad message was. 3007 // enough information here so that we can determine what the bad message was.
3003 base::debug::Alias(&error); 3008 base::debug::Alias(&error);
3004 bad_message::ReceivedBadMessage(render_process_id, 3009 bad_message::ReceivedBadMessage(render_process_id,
3005 bad_message::RPH_MOJO_PROCESS_ERROR); 3010 bad_message::RPH_MOJO_PROCESS_ERROR);
3006 } 3011 }
3007 3012
3008 } // namespace content 3013 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698