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

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

Issue 2863233002: [WebView] Move files from native to browser (Closed)
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "android_webview/native/aw_renderer_priority_manager.h"
6
7 #include "base/android/jni_android.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/render_process_host.h"
10 #include "jni/AwRendererPriorityManager_jni.h"
11
12 namespace android_webview {
13
14 AwRendererPriorityManager::AwRendererPriorityManager(
15 content::RenderProcessHost* host)
16 : host_(host), renderer_priority_(RENDERER_PRIORITY_INITIAL) {}
17
18 void AwRendererPriorityManager::SetRendererPriority(
19 RendererPriority renderer_priority) {
20 if (host_->GetHandle() == 0) {
21 return;
22 }
23 if (renderer_priority_ != renderer_priority) {
24 renderer_priority_ = renderer_priority;
25 content::BrowserThread::PostTask(
26 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
27 base::Bind(&SetRendererPriorityOnLauncherThread, host_->GetHandle(),
28 renderer_priority_));
29 }
30 }
31
32 // static
33 void AwRendererPriorityManager::SetRendererPriorityOnLauncherThread(
34 int pid,
35 RendererPriority renderer_priority) {
36 JNIEnv* env = base::android::AttachCurrentThread();
37 DCHECK(env);
38 Java_AwRendererPriorityManager_setRendererPriority(
39 env, static_cast<jint>(pid), static_cast<jint>(renderer_priority));
40 }
41
42 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698