Skip to content

Commit

Permalink
make global_instance_ more strict
Browse files Browse the repository at this point in the history
Fix a bug where global_instance_ was not set to zero.
Fix MockRenderThread to call OnChannelClosing properly.

Review URL: https://codereview.chromium.org/169063003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252078 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
hubbe@chromium.org committed Feb 19, 2014
1 parent bb2218c commit ffc735e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 1 addition & 3 deletions chrome/renderer/media/cast_ipc_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ CastIPCDispatcher::CastIPCDispatcher(

CastIPCDispatcher::~CastIPCDispatcher() {
DCHECK(io_message_loop_->BelongsToCurrentThread());
// Unfortunately, you do not always get a OnFilterRemoved call.
global_instance_ = NULL;
DCHECK(!global_instance_);
}

CastIPCDispatcher* CastIPCDispatcher::Get() {
Expand Down Expand Up @@ -74,7 +73,6 @@ void CastIPCDispatcher::OnFilterRemoved() {
void CastIPCDispatcher::OnChannelClosing() {
DCHECK(io_message_loop_->BelongsToCurrentThread());
DCHECK_EQ(this, global_instance_);
channel_ = NULL;
}

void CastIPCDispatcher::OnReceivedPacket(
Expand Down
5 changes: 5 additions & 0 deletions content/public/test/mock_render_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ MockRenderThread::MockRenderThread()
}

MockRenderThread::~MockRenderThread() {
while (!filters_.empty()) {
scoped_refptr<IPC::ChannelProxy::MessageFilter> filter = filters_.back();
filters_.pop_back();
filter->OnFilterRemoved();
}
}

void MockRenderThread::VerifyRunJavaScriptMessageSend(
Expand Down

0 comments on commit ffc735e

Please sign in to comment.