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

Side by Side Diff: components/web_resource/web_resource_service.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 11 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 unified diff | Download patch
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 #include "components/web_resource/web_resource_service.h" 5 #include "components/web_resource/web_resource_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 if (source->GetStatus().is_success() && source->GetResponseCode() == 200) { 72 if (source->GetStatus().is_success() && source->GetResponseCode() == 200) {
73 std::string data; 73 std::string data;
74 source->GetResponseAsString(&data); 74 source->GetResponseAsString(&data);
75 // Calls EndFetch() on completion. 75 // Calls EndFetch() on completion.
76 // Full JSON parsing might spawn a utility process (for security). 76 // Full JSON parsing might spawn a utility process (for security).
77 // To limit the the number of simultaneously active processes 77 // To limit the the number of simultaneously active processes
78 // (on Android in particular) we short-cut the full parsing in the case of 78 // (on Android in particular) we short-cut the full parsing in the case of
79 // trivially "empty" JSONs. 79 // trivially "empty" JSONs.
80 if (data.empty() || data == "{}") { 80 if (data.empty() || data == "{}") {
81 OnUnpackFinished(make_scoped_ptr(new base::DictionaryValue()).Pass()); 81 OnUnpackFinished(make_scoped_ptr(new base::DictionaryValue()));
82 } else { 82 } else {
83 parse_json_callback_.Run(data, 83 parse_json_callback_.Run(data,
84 base::Bind(&WebResourceService::OnUnpackFinished, 84 base::Bind(&WebResourceService::OnUnpackFinished,
85 weak_ptr_factory_.GetWeakPtr()), 85 weak_ptr_factory_.GetWeakPtr()),
86 base::Bind(&WebResourceService::OnUnpackError, 86 base::Bind(&WebResourceService::OnUnpackError,
87 weak_ptr_factory_.GetWeakPtr())); 87 weak_ptr_factory_.GetWeakPtr()));
88 } 88 }
89 } else { 89 } else {
90 // Don't parse data if attempt to download was unsuccessful. 90 // Don't parse data if attempt to download was unsuccessful.
91 // Stop loading new web resource data, and silently exit. 91 // Stop loading new web resource data, and silently exit.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Wait at least |start_fetch_delay_ms_|. 180 // Wait at least |start_fetch_delay_ms_|.
181 if (ms_until_update > start_fetch_delay_ms_) 181 if (ms_until_update > start_fetch_delay_ms_)
182 delay = ms_until_update; 182 delay = ms_until_update;
183 } 183 }
184 } 184 }
185 // Start fetch and wait for UpdateResourceCache. 185 // Start fetch and wait for UpdateResourceCache.
186 ScheduleFetch(delay); 186 ScheduleFetch(delay);
187 } 187 }
188 188
189 } // namespace web_resource 189 } // namespace web_resource
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698