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

Unified Diff: content/browser/appcache/appcache_interceptor.cc

Issue 2815913005: Switch to using scoped_ptr with UserData (Closed)
Patch Set: fixes Created 3 years, 8 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: content/browser/appcache/appcache_interceptor.cc
diff --git a/content/browser/appcache/appcache_interceptor.cc b/content/browser/appcache/appcache_interceptor.cc
index 8b916091dc7fcd9b23c5d6013c26e06eee851078..7d73fa0e9cad1ff526665a047ebefe9a5388a514 100644
--- a/content/browser/appcache/appcache_interceptor.cc
+++ b/content/browser/appcache/appcache_interceptor.cc
@@ -4,6 +4,8 @@
#include "content/browser/appcache/appcache_interceptor.h"
+#include <utility>
+
#include "base/debug/crash_logging.h"
#include "content/browser/appcache/appcache_backend_impl.h"
#include "content/browser/appcache/appcache_host.h"
@@ -21,9 +23,10 @@ static int kHandlerKey; // Value is not used.
namespace content {
-void AppCacheInterceptor::SetHandler(net::URLRequest* request,
- AppCacheRequestHandler* handler) {
- request->SetUserData(&kHandlerKey, handler); // request takes ownership
+void AppCacheInterceptor::SetHandler(
+ net::URLRequest* request,
+ std::unique_ptr<AppCacheRequestHandler> handler) {
+ request->SetUserData(&kHandlerKey, std::move(handler));
}
AppCacheRequestHandler* AppCacheInterceptor::GetHandler(
@@ -61,10 +64,10 @@ void AppCacheInterceptor::SetExtraRequestInfoForHost(
ResourceType resource_type,
bool should_reset_appcache) {
// Create a handler for this request and associate it with the request.
- AppCacheRequestHandler* handler =
+ std::unique_ptr<AppCacheRequestHandler> handler =
host->CreateRequestHandler(request, resource_type, should_reset_appcache);
if (handler)
- SetHandler(request, handler);
+ SetHandler(request, std::move(handler));
}
void AppCacheInterceptor::GetExtraResponseInfo(net::URLRequest* request,

Powered by Google App Engine
This is Rietveld 408576698