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

Side by Side Diff: content/browser/android/java/gin_java_bridge_message_filter.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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/android/java/gin_java_bridge_message_filter.h" 5 #include "content/browser/android/java/gin_java_bridge_message_filter.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" 10 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // static 87 // static
88 scoped_refptr<GinJavaBridgeMessageFilter> GinJavaBridgeMessageFilter::FromHost( 88 scoped_refptr<GinJavaBridgeMessageFilter> GinJavaBridgeMessageFilter::FromHost(
89 GinJavaBridgeDispatcherHost* host, bool create_if_not_exists) { 89 GinJavaBridgeDispatcherHost* host, bool create_if_not_exists) {
90 RenderProcessHost* rph = host->web_contents()->GetRenderProcessHost(); 90 RenderProcessHost* rph = host->web_contents()->GetRenderProcessHost();
91 scoped_refptr<GinJavaBridgeMessageFilter> filter = 91 scoped_refptr<GinJavaBridgeMessageFilter> filter =
92 base::UserDataAdapter<GinJavaBridgeMessageFilter>::Get( 92 base::UserDataAdapter<GinJavaBridgeMessageFilter>::Get(
93 rph, kGinJavaBridgeMessageFilterKey); 93 rph, kGinJavaBridgeMessageFilterKey);
94 if (!filter && create_if_not_exists) { 94 if (!filter && create_if_not_exists) {
95 filter = new GinJavaBridgeMessageFilter(); 95 filter = new GinJavaBridgeMessageFilter();
96 rph->AddFilter(filter.get()); 96 rph->AddFilter(filter.get());
97 rph->SetUserData(kGinJavaBridgeMessageFilterKey, 97 rph->SetUserData(
98 new base::UserDataAdapter<GinJavaBridgeMessageFilter>( 98 kGinJavaBridgeMessageFilterKey,
99 filter.get())); 99 base::MakeUnique<base::UserDataAdapter<GinJavaBridgeMessageFilter>>(
100 filter.get()));
100 } 101 }
101 return filter; 102 return filter;
102 } 103 }
103 104
104 GinJavaBridgeDispatcherHost* GinJavaBridgeMessageFilter::FindHost() { 105 GinJavaBridgeDispatcherHost* GinJavaBridgeMessageFilter::FindHost() {
105 base::AutoLock locker(hosts_lock_); 106 base::AutoLock locker(hosts_lock_);
106 auto iter = hosts_.find(current_routing_id_); 107 auto iter = hosts_.find(current_routing_id_);
107 if (iter != hosts_.end()) 108 if (iter != hosts_.end())
108 return iter->second; 109 return iter->second;
109 // Not being able to find a host is OK -- we can receive messages from 110 // Not being able to find a host is OK -- we can receive messages from
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 171 }
171 172
172 // static 173 // static
173 void GinJavaBridgeMessageFilter::RemoveFilter( 174 void GinJavaBridgeMessageFilter::RemoveFilter(
174 GinJavaBridgeDispatcherHost* host) { 175 GinJavaBridgeDispatcherHost* host) {
175 RenderProcessHost* rph = host->web_contents()->GetRenderProcessHost(); 176 RenderProcessHost* rph = host->web_contents()->GetRenderProcessHost();
176 rph->RemoveUserData(kGinJavaBridgeMessageFilterKey); 177 rph->RemoveUserData(kGinJavaBridgeMessageFilterKey);
177 } 178 }
178 179
179 } // namespace content 180 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/context_selection_client.cc ('k') | content/browser/blob_storage/chrome_blob_storage_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698