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

Side by Side Diff: base/message_loop_unittest.cc

Issue 16092013: Use base::MessageLoop in more files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again, sigh 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/mac/libdispatch_task_runner_unittest.cc ('k') | base/prefs/pref_service.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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 1413
1414 void RunTest_RecursivePosts(MessageLoop::Type message_loop_type, 1414 void RunTest_RecursivePosts(MessageLoop::Type message_loop_type,
1415 int num_times) { 1415 int num_times) {
1416 MessageLoop loop(message_loop_type); 1416 MessageLoop loop(message_loop_type);
1417 loop.PostTask(FROM_HERE, Bind(&PostNTasksThenQuit, num_times)); 1417 loop.PostTask(FROM_HERE, Bind(&PostNTasksThenQuit, num_times));
1418 loop.Run(); 1418 loop.Run();
1419 } 1419 }
1420 1420
1421 #if defined(OS_WIN) 1421 #if defined(OS_WIN)
1422 1422
1423 class DispatcherImpl : public MessageLoopForUI::Dispatcher { 1423 class DispatcherImpl : public base::MessageLoopForUI::Dispatcher {
1424 public: 1424 public:
1425 DispatcherImpl() : dispatch_count_(0) {} 1425 DispatcherImpl() : dispatch_count_(0) {}
1426 1426
1427 virtual bool Dispatch(const NativeEvent& msg) OVERRIDE { 1427 virtual bool Dispatch(const NativeEvent& msg) OVERRIDE {
1428 ::TranslateMessage(&msg); 1428 ::TranslateMessage(&msg);
1429 ::DispatchMessage(&msg); 1429 ::DispatchMessage(&msg);
1430 // Do not count WM_TIMER since it is not what we post and it will cause 1430 // Do not count WM_TIMER since it is not what we post and it will cause
1431 // flakiness. 1431 // flakiness.
1432 if (msg.message != WM_TIMER) 1432 if (msg.message != WM_TIMER)
1433 ++dispatch_count_; 1433 ++dispatch_count_;
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 // On Linux, the pipe buffer size is 64KiB by default. The bug caused one 2108 // On Linux, the pipe buffer size is 64KiB by default. The bug caused one
2109 // byte accumulated in the pipe per two posts, so we should repeat 128K 2109 // byte accumulated in the pipe per two posts, so we should repeat 128K
2110 // times to reproduce the bug. 2110 // times to reproduce the bug.
2111 const int kNumTimes = 1 << 17; 2111 const int kNumTimes = 1 << 17;
2112 RunTest_RecursivePosts(MessageLoop::TYPE_DEFAULT, kNumTimes); 2112 RunTest_RecursivePosts(MessageLoop::TYPE_DEFAULT, kNumTimes);
2113 RunTest_RecursivePosts(MessageLoop::TYPE_UI, kNumTimes); 2113 RunTest_RecursivePosts(MessageLoop::TYPE_UI, kNumTimes);
2114 RunTest_RecursivePosts(MessageLoop::TYPE_IO, kNumTimes); 2114 RunTest_RecursivePosts(MessageLoop::TYPE_IO, kNumTimes);
2115 } 2115 }
2116 2116
2117 } // namespace base 2117 } // namespace base
OLDNEW
« no previous file with comments | « base/mac/libdispatch_task_runner_unittest.cc ('k') | base/prefs/pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698