OLD | NEW |
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 "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // static | 172 // static |
173 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID( | 173 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID( |
174 int render_process_id, int render_frame_id) { | 174 int render_process_id, int render_frame_id) { |
175 AwContents* aw_contents = AwContents::FromWebContents( | 175 AwContents* aw_contents = AwContents::FromWebContents( |
176 content::WebContents::FromRenderFrameHost( | 176 content::WebContents::FromRenderFrameHost( |
177 content::RenderFrameHost::FromID(render_process_id, | 177 content::RenderFrameHost::FromID(render_process_id, |
178 render_frame_id))); | 178 render_frame_id))); |
179 return aw_contents; | 179 return aw_contents; |
180 } | 180 } |
181 | 181 |
| 182 // static |
| 183 AwRenderProcessGoneDelegate* AwRenderProcessGoneDelegate::FromWebContents( |
| 184 content::WebContents* web_contents) { |
| 185 return AwContents::FromWebContents(web_contents); |
| 186 } |
| 187 |
182 AwContents::AwContents(std::unique_ptr<WebContents> web_contents) | 188 AwContents::AwContents(std::unique_ptr<WebContents> web_contents) |
183 : content::WebContentsObserver(web_contents.get()), | 189 : content::WebContentsObserver(web_contents.get()), |
184 functor_(nullptr), | 190 functor_(nullptr), |
185 browser_view_renderer_( | 191 browser_view_renderer_( |
186 this, | 192 this, |
187 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)), | 193 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)), |
188 web_contents_(std::move(web_contents)), | 194 web_contents_(std::move(web_contents)), |
189 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()) { | 195 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()) { |
190 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); | 196 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); |
191 icon_helper_.reset(new IconHelper(web_contents_.get())); | 197 icon_helper_.reset(new IconHelper(web_contents_.get())); |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 web_contents_->GetRenderViewHost()) { | 1297 web_contents_->GetRenderViewHost()) { |
1292 compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID(); | 1298 compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID(); |
1293 compositor_id.routing_id = | 1299 compositor_id.routing_id = |
1294 web_contents_->GetRenderViewHost()->GetRoutingID(); | 1300 web_contents_->GetRenderViewHost()->GetRoutingID(); |
1295 } else { | 1301 } else { |
1296 LOG(WARNING) << "failed setting the compositor on detaching interstitital"; | 1302 LOG(WARNING) << "failed setting the compositor on detaching interstitital"; |
1297 } | 1303 } |
1298 browser_view_renderer_.SetActiveCompositorID(compositor_id); | 1304 browser_view_renderer_.SetActiveCompositorID(compositor_id); |
1299 } | 1305 } |
1300 | 1306 |
| 1307 void AwContents::OnRenderProcessGone(int child_process_id) { |
| 1308 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1309 JNIEnv* env = AttachCurrentThread(); |
| 1310 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1311 if (obj.is_null()) |
| 1312 return; |
| 1313 |
| 1314 Java_AwContents_onRenderProcessGone(env, obj, child_process_id); |
| 1315 } |
| 1316 |
| 1317 bool AwContents::OnRenderProcessGoneDetail(int child_process_id, |
| 1318 bool crashed) { |
| 1319 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1320 JNIEnv* env = AttachCurrentThread(); |
| 1321 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1322 if (obj.is_null()) |
| 1323 return false; |
| 1324 |
| 1325 return Java_AwContents_onRenderProcessGoneDetail(env, obj, |
| 1326 child_process_id, crashed); |
| 1327 } |
| 1328 |
1301 } // namespace android_webview | 1329 } // namespace android_webview |
OLD | NEW |