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

Side by Side Diff: chrome/browser/search/instant_io_context.cc

Issue 2842833003: Update SupportsUserData uses with unique_ptr. (Closed)
Patch Set: rebase Created 3 years, 7 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
« no previous file with comments | « chrome/browser/profiles/profile_android.cc ('k') | chrome/browser/ssl/ssl_error_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/search/instant_io_context.h" 5 #include "chrome/browser/search/instant_io_context.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
8 #include "content/public/browser/resource_context.h" 9 #include "content/public/browser/resource_context.h"
9 #include "content/public/browser/resource_request_info.h" 10 #include "content/public/browser/resource_request_info.h"
10 #include "net/url_request/url_request.h" 11 #include "net/url_request/url_request.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
13 using content::BrowserThread; 14 using content::BrowserThread;
14 15
15 namespace { 16 namespace {
16 17
(...skipping 26 matching lines...) Expand all
43 44
44 InstantIOContext::~InstantIOContext() { 45 InstantIOContext::~InstantIOContext() {
45 } 46 }
46 47
47 // static 48 // static
48 void InstantIOContext::SetUserDataOnIO( 49 void InstantIOContext::SetUserDataOnIO(
49 content::ResourceContext* resource_context, 50 content::ResourceContext* resource_context,
50 scoped_refptr<InstantIOContext> instant_io_context) { 51 scoped_refptr<InstantIOContext> instant_io_context) {
51 resource_context->SetUserData( 52 resource_context->SetUserData(
52 InstantIOContext::kInstantIOContextKeyName, 53 InstantIOContext::kInstantIOContextKeyName,
53 new base::UserDataAdapter<InstantIOContext>(instant_io_context.get())); 54 base::MakeUnique<base::UserDataAdapter<InstantIOContext>>(
55 instant_io_context.get()));
54 } 56 }
55 57
56 // static 58 // static
57 void InstantIOContext::AddInstantProcessOnIO( 59 void InstantIOContext::AddInstantProcessOnIO(
58 scoped_refptr<InstantIOContext> instant_io_context, 60 scoped_refptr<InstantIOContext> instant_io_context,
59 int process_id) { 61 int process_id) {
60 DCHECK_CURRENTLY_ON(BrowserThread::IO); 62 DCHECK_CURRENTLY_ON(BrowserThread::IO);
61 instant_io_context->process_ids_.insert(process_id); 63 instant_io_context->process_ids_.insert(process_id);
62 } 64 }
63 65
(...skipping 29 matching lines...) Expand all
93 // so, allow this request since it's not going to another renderer. 95 // so, allow this request since it's not going to another renderer.
94 if (process_id == -1 || instant_io_context->IsInstantProcess(process_id)) 96 if (process_id == -1 || instant_io_context->IsInstantProcess(process_id))
95 return true; 97 return true;
96 return false; 98 return false;
97 } 99 }
98 100
99 bool InstantIOContext::IsInstantProcess(int process_id) const { 101 bool InstantIOContext::IsInstantProcess(int process_id) const {
100 DCHECK_CURRENTLY_ON(BrowserThread::IO); 102 DCHECK_CURRENTLY_ON(BrowserThread::IO);
101 return process_ids_.find(process_id) != process_ids_.end(); 103 return process_ids_.find(process_id) != process_ids_.end();
102 } 104 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_android.cc ('k') | chrome/browser/ssl/ssl_error_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698