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

Side by Side Diff: android_webview/native/aw_contents_io_thread_client_impl.cc

Issue 135443002: Fix race condition introduced in r242200 where AwContentsIoThreadClient is queried before a subfram… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "android_webview/native/aw_contents_io_thread_client_impl.h" 5 #include "android_webview/native/aw_contents_io_thread_client_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "android_webview/native/intercepted_request_data_impl.h" 10 #include "android_webview/native/intercepted_request_data_impl.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 JNIEnv* env = AttachCurrentThread(); 160 JNIEnv* env = AttachCurrentThread();
161 ScopedJavaLocalRef<jobject> java_delegate = 161 ScopedJavaLocalRef<jobject> java_delegate =
162 client_data.io_thread_client.get(env); 162 client_data.io_thread_client.get(env);
163 DCHECK(!client_data.pending_association || java_delegate.is_null()); 163 DCHECK(!client_data.pending_association || java_delegate.is_null());
164 return scoped_ptr<AwContentsIoThreadClient>(new AwContentsIoThreadClientImpl( 164 return scoped_ptr<AwContentsIoThreadClient>(new AwContentsIoThreadClientImpl(
165 client_data.pending_association, java_delegate)); 165 client_data.pending_association, java_delegate));
166 } 166 }
167 167
168 // static 168 // static
169 void AwContentsIoThreadClient::SubFrameCreated(int render_process_id,
170 int parent_render_frame_id,
171 int child_render_frame_id) {
172 pair<int, int> parent_rfh_id(render_process_id, parent_render_frame_id);
173 pair<int, int> child_rfh_id(render_process_id, child_render_frame_id);
174 IoThreadClientData client_data;
175 if (!RfhToIoThreadClientMap::GetInstance()->Get(parent_rfh_id,
176 &client_data)) {
177 NOTREACHED();
178 return;
179 }
180
181 RfhToIoThreadClientMap::GetInstance()->Set(child_rfh_id, client_data);
182 }
183
184 // static
169 void AwContentsIoThreadClientImpl::RegisterPendingContents( 185 void AwContentsIoThreadClientImpl::RegisterPendingContents(
170 WebContents* web_contents) { 186 WebContents* web_contents) {
171 IoThreadClientData client_data; 187 IoThreadClientData client_data;
172 client_data.pending_association = true; 188 client_data.pending_association = true;
173 RfhToIoThreadClientMap::GetInstance()->Set( 189 RfhToIoThreadClientMap::GetInstance()->Set(
174 GetRenderFrameHostIdPair(web_contents->GetMainFrame()), client_data); 190 GetRenderFrameHostIdPair(web_contents->GetMainFrame()), client_data);
175 } 191 }
176 192
177 // static 193 // static
178 void AwContentsIoThreadClientImpl::Associate( 194 void AwContentsIoThreadClientImpl::Associate(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 327
312 Java_AwContentsIoThreadClient_newLoginRequest( 328 Java_AwContentsIoThreadClient_newLoginRequest(
313 env, java_object_.obj(), jrealm.obj(), jaccount.obj(), jargs.obj()); 329 env, java_object_.obj(), jrealm.obj(), jaccount.obj(), jargs.obj());
314 } 330 }
315 331
316 bool RegisterAwContentsIoThreadClientImpl(JNIEnv* env) { 332 bool RegisterAwContentsIoThreadClientImpl(JNIEnv* env) {
317 return RegisterNativesImpl(env); 333 return RegisterNativesImpl(env);
318 } 334 }
319 335
320 } // namespace android_webview 336 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/common/render_view_messages.h ('k') | android_webview/renderer/aw_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698