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

Side by Side Diff: base/message_loop/message_pump_android.cc

Issue 16897006: Move message_pump to base/message_loop. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 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
« no previous file with comments | « base/message_loop/message_pump_android.h ('k') | base/message_loop/message_pump_aurax11.h » ('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 "base/message_pump_android.h" 5 #include "base/message_loop/message_pump_android.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "jni/SystemMessageHandler_jni.h" 15 #include "jni/SystemMessageHandler_jni.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 MessagePumpForUI::~MessagePumpForUI() { 69 MessagePumpForUI::~MessagePumpForUI() {
70 } 70 }
71 71
72 void MessagePumpForUI::Run(Delegate* delegate) { 72 void MessagePumpForUI::Run(Delegate* delegate) {
73 NOTREACHED() << "UnitTests should rely on MessagePumpForUIStub in" 73 NOTREACHED() << "UnitTests should rely on MessagePumpForUIStub in"
74 " test_stub_android.h"; 74 " test_stub_android.h";
75 } 75 }
76 76
77 void MessagePumpForUI::Start(Delegate* delegate) { 77 void MessagePumpForUI::Start(Delegate* delegate) {
78 run_loop_ = new base::RunLoop(); 78 run_loop_ = new RunLoop();
79 // Since the RunLoop was just created above, BeforeRun should be guaranteed to 79 // Since the RunLoop was just created above, BeforeRun should be guaranteed to
80 // return true (it only returns false if the RunLoop has been Quit already). 80 // return true (it only returns false if the RunLoop has been Quit already).
81 if (!run_loop_->BeforeRun()) 81 if (!run_loop_->BeforeRun())
82 NOTREACHED(); 82 NOTREACHED();
83 83
84 DCHECK(g_system_message_handler_obj.Get().is_null()); 84 DCHECK(g_system_message_handler_obj.Get().is_null());
85 85
86 JNIEnv* env = base::android::AttachCurrentThread(); 86 JNIEnv* env = base::android::AttachCurrentThread();
87 DCHECK(env); 87 DCHECK(env);
88 88
(...skipping 28 matching lines...) Expand all
117 g_system_message_handler_obj.Get().obj()); 117 g_system_message_handler_obj.Get().obj());
118 } 118 }
119 119
120 void MessagePumpForUI::ScheduleDelayedWork(const TimeTicks& delayed_work_time) { 120 void MessagePumpForUI::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
121 DCHECK(!g_system_message_handler_obj.Get().is_null()); 121 DCHECK(!g_system_message_handler_obj.Get().is_null());
122 122
123 JNIEnv* env = base::android::AttachCurrentThread(); 123 JNIEnv* env = base::android::AttachCurrentThread();
124 DCHECK(env); 124 DCHECK(env);
125 125
126 jlong millis = 126 jlong millis =
127 (delayed_work_time - base::TimeTicks::Now()).InMillisecondsRoundedUp(); 127 (delayed_work_time - TimeTicks::Now()).InMillisecondsRoundedUp();
128 // Note that we're truncating to milliseconds as required by the java side, 128 // Note that we're truncating to milliseconds as required by the java side,
129 // even though delayed_work_time is microseconds resolution. 129 // even though delayed_work_time is microseconds resolution.
130 Java_SystemMessageHandler_setDelayedTimer(env, 130 Java_SystemMessageHandler_setDelayedTimer(env,
131 g_system_message_handler_obj.Get().obj(), millis); 131 g_system_message_handler_obj.Get().obj(), millis);
132 } 132 }
133 133
134 // static 134 // static
135 bool MessagePumpForUI::RegisterBindings(JNIEnv* env) { 135 bool MessagePumpForUI::RegisterBindings(JNIEnv* env) {
136 return RegisterNativesImpl(env); 136 return RegisterNativesImpl(env);
137 } 137 }
138 138
139 } // namespace base 139 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_pump_android.h ('k') | base/message_loop/message_pump_aurax11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698