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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)), | 203 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)), |
204 web_contents_(std::move(web_contents)), | 204 web_contents_(std::move(web_contents)), |
205 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()), | 205 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()), |
206 renderer_requested_priority_( | 206 renderer_requested_priority_( |
207 AwRendererPriorityManager::RENDERER_PRIORITY_HIGH), | 207 AwRendererPriorityManager::RENDERER_PRIORITY_HIGH), |
208 renderer_priority_waived_when_not_visible_(false) { | 208 renderer_priority_waived_when_not_visible_(false) { |
209 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); | 209 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); |
210 icon_helper_.reset(new IconHelper(web_contents_.get())); | 210 icon_helper_.reset(new IconHelper(web_contents_.get())); |
211 icon_helper_->SetListener(this); | 211 icon_helper_->SetListener(this); |
212 web_contents_->SetUserData(android_webview::kAwContentsUserDataKey, | 212 web_contents_->SetUserData(android_webview::kAwContentsUserDataKey, |
213 new AwContentsUserData(this)); | 213 base::MakeUnique<AwContentsUserData>(this)); |
214 browser_view_renderer_.RegisterWithWebContents(web_contents_.get()); | 214 browser_view_renderer_.RegisterWithWebContents(web_contents_.get()); |
215 | 215 |
216 CompositorID compositor_id; | 216 CompositorID compositor_id; |
217 if (web_contents_->GetRenderProcessHost() && | 217 if (web_contents_->GetRenderProcessHost() && |
218 web_contents_->GetRenderViewHost()) { | 218 web_contents_->GetRenderViewHost()) { |
219 compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID(); | 219 compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID(); |
220 compositor_id.routing_id = | 220 compositor_id.routing_id = |
221 web_contents_->GetRenderViewHost()->GetRoutingID(); | 221 web_contents_->GetRenderViewHost()->GetRoutingID(); |
222 } | 222 } |
223 | 223 |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 | 1232 |
1233 void AwContents::UpdateRendererPriority() { | 1233 void AwContents::UpdateRendererPriority() { |
1234 UpdateRendererPriority(GetComputedRendererPriority()); | 1234 UpdateRendererPriority(GetComputedRendererPriority()); |
1235 } | 1235 } |
1236 | 1236 |
1237 AwRendererPriorityManager* AwContents::GetAwRendererPriorityManager() { | 1237 AwRendererPriorityManager* AwContents::GetAwRendererPriorityManager() { |
1238 content::RenderProcessHost* rph = web_contents_->GetRenderProcessHost(); | 1238 content::RenderProcessHost* rph = web_contents_->GetRenderProcessHost(); |
1239 AwRendererPriorityManager* manager = static_cast<AwRendererPriorityManager*>( | 1239 AwRendererPriorityManager* manager = static_cast<AwRendererPriorityManager*>( |
1240 rph->GetUserData(kComputedRendererPriorityUserDataKey)); | 1240 rph->GetUserData(kComputedRendererPriorityUserDataKey)); |
1241 if (manager == nullptr) { | 1241 if (manager == nullptr) { |
| 1242 manager = new AwRendererPriorityManager(rph); |
1242 rph->SetUserData(kComputedRendererPriorityUserDataKey, | 1243 rph->SetUserData(kComputedRendererPriorityUserDataKey, |
1243 manager = new AwRendererPriorityManager(rph)); | 1244 base::WrapUnique(manager)); |
1244 } | 1245 } |
1245 return manager; | 1246 return manager; |
1246 } | 1247 } |
1247 | 1248 |
1248 AwRendererPriorityManager::RendererPriority | 1249 AwRendererPriorityManager::RendererPriority |
1249 AwContents::GetCurrentRendererPriority() { | 1250 AwContents::GetCurrentRendererPriority() { |
1250 return GetAwRendererPriorityManager()->GetRendererPriority(); | 1251 return GetAwRendererPriorityManager()->GetRendererPriority(); |
1251 } | 1252 } |
1252 | 1253 |
1253 jint AwContents::GetRendererCurrentPriority( | 1254 jint AwContents::GetRendererCurrentPriority( |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 | 1450 |
1450 return Java_AwContents_onRenderProcessGoneDetail(env, obj, | 1451 return Java_AwContents_onRenderProcessGoneDetail(env, obj, |
1451 child_process_id, crashed); | 1452 child_process_id, crashed); |
1452 } | 1453 } |
1453 | 1454 |
1454 void AwContents::RenderProcessReady(content::RenderProcessHost* host) { | 1455 void AwContents::RenderProcessReady(content::RenderProcessHost* host) { |
1455 UpdateRendererPriority(); | 1456 UpdateRendererPriority(); |
1456 } | 1457 } |
1457 | 1458 |
1458 } // namespace android_webview | 1459 } // namespace android_webview |
OLD | NEW |