Commit 405549be authored by Timothy Loh's avatar Timothy Loh Committed by Commit Bot

Remove redundant clearing from ~PermissionRequestManager()

PermissionRequestManager's destructor currently clears its request
vectors, but as it is a WebContentsUserData these should already have
been cleared in WebContentsDestroyed. This patch replaces this with
assertions the vectors are empty.

Change-Id: I71d56e91356435698c9dbcb4fcc347b997d05e6f
Reviewed-on: https://chromium-review.googlesource.com/562845Reviewed-by: default avatarRaymes Khoury <raymes@chromium.org>
Commit-Queue: Timothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485176}
parent 51446e5d
......@@ -121,15 +121,9 @@ PermissionRequestManager::PermissionRequestManager(
}
PermissionRequestManager::~PermissionRequestManager() {
if (view_ != NULL)
view_->SetDelegate(NULL);
for (PermissionRequest* request : requests_)
request->RequestFinished();
for (PermissionRequest* request : queued_requests_)
request->RequestFinished();
for (const auto& entry : duplicate_requests_)
entry.second->RequestFinished();
DCHECK(requests_.empty());
DCHECK(duplicate_requests_.empty());
DCHECK(queued_requests_.empty());
}
void PermissionRequestManager::AddRequest(PermissionRequest* request) {
......
......@@ -51,13 +51,13 @@ class PermissionRequestManagerTest : public ChromeRenderViewHostTestHarness {
SetContents(CreateTestWebContents());
NavigateAndCommit(GURL("http://www.google.com"));
manager_.reset(new PermissionRequestManager(web_contents()));
prompt_factory_.reset(new MockPermissionPromptFactory(manager_.get()));
PermissionRequestManager::CreateForWebContents(web_contents());
manager_ = PermissionRequestManager::FromWebContents(web_contents());
prompt_factory_.reset(new MockPermissionPromptFactory(manager_));
}
void TearDown() override {
prompt_factory_.reset();
manager_.reset();
ChromeRenderViewHostTestHarness::TearDown();
}
......@@ -101,7 +101,7 @@ class PermissionRequestManagerTest : public ChromeRenderViewHostTestHarness {
MockPermissionRequest iframe_request_same_domain_;
MockPermissionRequest iframe_request_other_domain_;
MockPermissionRequest iframe_request_mic_other_domain_;
std::unique_ptr<PermissionRequestManager> manager_;
PermissionRequestManager* manager_;
std::unique_ptr<MockPermissionPromptFactory> prompt_factory_;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment