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

Unified Diff: chrome/browser/ui/views/hung_renderer_view.cc

Issue 2606293002: Remove ScopedVector from chrome/browser/ui. (Closed)
Patch Set: view Created 3 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/hung_renderer_view.cc
diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc
index 83ef593c26043be5b21da289a948062175b21908..50262ac12485f25583a95ff471d17f4512e467d5 100644
--- a/chrome/browser/ui/views/hung_renderer_view.cc
+++ b/chrome/browser/ui/views/hung_renderer_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/hung_renderer_view.h"
#include "base/i18n/rtl.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -80,13 +81,14 @@ void HungPagesTableModel::InitForWebContents(WebContents* hung_contents) {
if (hung_contents) {
// Force hung_contents to be first.
if (hung_contents) {
- tab_observers_.push_back(new WebContentsObserverImpl(this,
- hung_contents));
+ tab_observers_.push_back(
+ base::MakeUnique<WebContentsObserverImpl>(this, hung_contents));
}
for (TabContentsIterator it; !it.done(); it.Next()) {
if (*it != hung_contents &&
it->GetRenderProcessHost() == hung_contents->GetRenderProcessHost())
- tab_observers_.push_back(new WebContentsObserverImpl(this, *it));
+ tab_observers_.push_back(
+ base::MakeUnique<WebContentsObserverImpl>(this, *it));
}
}
// The world is different.
@@ -134,8 +136,11 @@ void HungPagesTableModel::GetGroupRange(int model_index,
void HungPagesTableModel::TabDestroyed(WebContentsObserverImpl* tab) {
// Clean up tab_observers_ and notify our observer.
- TabObservers::iterator i = std::find(
- tab_observers_.begin(), tab_observers_.end(), tab);
+ auto i =
+ std::find_if(tab_observers_.begin(), tab_observers_.end(),
+ [tab](const std::unique_ptr<WebContentsObserverImpl>& ptr) {
+ return ptr.get() == tab;
+ });
Nico 2017/01/03 18:12:35 again, just use a loop instead of find_if and then
Avi (use Gerrit) 2017/01/03 22:54:53 Done.
DCHECK(i != tab_observers_.end());
int index = static_cast<int>(i - tab_observers_.begin());
tab_observers_.erase(i);

Powered by Google App Engine
This is Rietveld 408576698