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

Unified Diff: content/renderer/mojo_context_state.cc

Issue 2705073003: Remove ScopedVector from content/renderer/. (Closed)
Patch Set: Rebase only Created 3 years, 10 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
« no previous file with comments | « content/renderer/mojo_context_state.h ('k') | content/renderer/pepper/pepper_audio_encoder_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/mojo_context_state.cc
diff --git a/content/renderer/mojo_context_state.cc b/content/renderer/mojo_context_state.cc
index c3ff13379cd4e9ea4b23df8671784752fe7fea65..381b4455c8acf86ef11e33a688447d22f568c174 100644
--- a/content/renderer/mojo_context_state.cc
+++ b/content/renderer/mojo_context_state.cc
@@ -11,6 +11,7 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/ref_counted_memory.h"
#include "base/stl_util.h"
@@ -182,7 +183,7 @@ void MojoContextState::FetchModule(const std::string& id) {
DCHECK(fetched_modules_.find(id) == fetched_modules_.end());
fetched_modules_.insert(id);
ResourceFetcher* fetcher = ResourceFetcher::Create(url);
- module_fetchers_.push_back(fetcher);
+ module_fetchers_.push_back(base::WrapUnique(fetcher));
fetcher->Start(frame_,
blink::WebURLRequest::RequestContextScript,
base::Bind(&MojoContextState::OnFetchModuleComplete,
@@ -201,9 +202,14 @@ void MojoContextState::OnFetchModuleComplete(
DCHECK_EQ(module_prefix_ + id, response.url().string().utf8());
// We can't delete fetch right now as the arguments to this function come from
// it and are used below. Instead use a scope_ptr to cleanup.
- std::unique_ptr<ResourceFetcher> deleter(fetcher);
- module_fetchers_.weak_erase(
- std::find(module_fetchers_.begin(), module_fetchers_.end(), fetcher));
+ auto iter =
+ std::find_if(module_fetchers_.begin(), module_fetchers_.end(),
+ [fetcher](const std::unique_ptr<ResourceFetcher>& item) {
+ return item.get() == fetcher;
+ });
+ std::unique_ptr<ResourceFetcher> deleter = std::move(*iter);
+ module_fetchers_.erase(iter);
+
if (data.empty()) {
LOG(ERROR) << "Fetched empty source for module \"" << id << "\"";
return;
« no previous file with comments | « content/renderer/mojo_context_state.h ('k') | content/renderer/pepper/pepper_audio_encoder_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698