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

Side by Side Diff: content/renderer/gpu/compositor_thread.cc

Issue 11880014: cc: Set ui/gpu/cc/ipc/upload/raster thread priorities. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address feedback (use static). Created 7 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
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | ui/gl/async_pixel_transfer_delegate_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/renderer/gpu/compositor_thread.h" 5 #include "content/renderer/gpu/compositor_thread.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "content/renderer/gpu/input_event_filter.h" 9 #include "content/renderer/gpu/input_event_filter.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebActiveWheelFlingPa rameters.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebActiveWheelFlingPa rameters.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositorInputHan dlerClient.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositorInputHan dlerClient.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositorInputHan dler.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositorInputHan dler.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
14 14
15 #if defined(OS_ANDROID)
16 // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
17 #include <sys/resource.h>
18 #endif
19
15 using WebKit::WebCompositorInputHandler; 20 using WebKit::WebCompositorInputHandler;
16 using WebKit::WebInputEvent; 21 using WebKit::WebInputEvent;
17 22
18 namespace content { 23 namespace content {
19 24
20 //------------------------------------------------------------------------------ 25 //------------------------------------------------------------------------------
21 26
22 class CompositorThread::InputHandlerWrapper 27 class CompositorThread::InputHandlerWrapper
23 : public WebKit::WebCompositorInputHandlerClient, 28 : public WebKit::WebCompositorInputHandlerClient,
24 public base::RefCountedThreadSafe<InputHandlerWrapper> { 29 public base::RefCountedThreadSafe<InputHandlerWrapper> {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 scoped_refptr<base::MessageLoopProxy> main_loop_; 81 scoped_refptr<base::MessageLoopProxy> main_loop_;
77 82
78 // Can only be accessed on the main thread. 83 // Can only be accessed on the main thread.
79 base::WeakPtr<RenderViewImpl> render_view_impl_; 84 base::WeakPtr<RenderViewImpl> render_view_impl_;
80 85
81 DISALLOW_COPY_AND_ASSIGN(InputHandlerWrapper); 86 DISALLOW_COPY_AND_ASSIGN(InputHandlerWrapper);
82 }; 87 };
83 88
84 //------------------------------------------------------------------------------ 89 //------------------------------------------------------------------------------
85 90
91 #if defined(OS_ANDROID)
92 // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
93 namespace {
94 void SetHighThreadPriority() {
95 int nice_value = -6; // High priority.
96 setpriority(PRIO_PROCESS, base::PlatformThread::CurrentId(), nice_value);
97 }
98 }
99 #endif
100
86 CompositorThread::CompositorThread(IPC::Listener* main_listener) 101 CompositorThread::CompositorThread(IPC::Listener* main_listener)
87 : thread_("Compositor") { 102 : thread_("Compositor") {
88 filter_ = 103 filter_ =
89 new InputEventFilter(main_listener, 104 new InputEventFilter(main_listener,
90 thread_.message_loop()->message_loop_proxy(), 105 thread_.message_loop()->message_loop_proxy(),
91 base::Bind(&CompositorThread::HandleInputEvent, 106 base::Bind(&CompositorThread::HandleInputEvent,
92 base::Unretained(this))); 107 base::Unretained(this)));
108 #if defined(OS_ANDROID)
109 // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
110 thread_.message_loop()->PostTask(FROM_HERE,
111 base::Bind(&SetHighThreadPriority));
112 #endif
93 } 113 }
94 114
95 CompositorThread::~CompositorThread() { 115 CompositorThread::~CompositorThread() {
96 } 116 }
97 117
98 IPC::ChannelProxy::MessageFilter* CompositorThread::GetMessageFilter() const { 118 IPC::ChannelProxy::MessageFilter* CompositorThread::GetMessageFilter() const {
99 return filter_; 119 return filter_;
100 } 120 }
101 121
102 void CompositorThread::AddInputHandler( 122 void CompositorThread::AddInputHandler(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 TRACE_EVENT0("CompositorThread::HandleInputEvent", "NoInputHandlerFound"); 180 TRACE_EVENT0("CompositorThread::HandleInputEvent", "NoInputHandlerFound");
161 // Oops, we no longer have an interested input handler.. 181 // Oops, we no longer have an interested input handler..
162 filter_->DidNotHandleInputEvent(true); 182 filter_->DidNotHandleInputEvent(true);
163 return; 183 return;
164 } 184 }
165 185
166 it->second->input_handler()->handleInputEvent(*input_event); 186 it->second->input_handler()->handleInputEvent(*input_event);
167 } 187 }
168 188
169 } // namespace content 189 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | ui/gl/async_pixel_transfer_delegate_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698