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

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

Issue 2963623002: Make base::WeakPtr::Get() fast (Closed)
Patch Set: Move WeakReference::Flag::Invalidate out-of-line; it's only called from WeakReferenceOwner::Invalid… Created 3 years, 5 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
« base/memory/weak_ptr.cc ('K') | « base/memory/weak_ptr.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_loop/message_loop_test.h" 5 #include "base/message_loop/message_loop_test.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 MessageLoop::current()->SetNestableTasksAllowed(true); 361 MessageLoop::current()->SetNestableTasksAllowed(true);
362 RunLoop().Run(); 362 RunLoop().Run();
363 } 363 }
364 MessageLoop::current()->QuitWhenIdle(); 364 MessageLoop::current()->QuitWhenIdle();
365 } 365 }
366 366
367 void RunTest_Nesting(MessagePumpFactory factory) { 367 void RunTest_Nesting(MessagePumpFactory factory) {
368 std::unique_ptr<MessagePump> pump(factory()); 368 std::unique_ptr<MessagePump> pump(factory());
369 MessageLoop loop(std::move(pump)); 369 MessageLoop loop(std::move(pump));
370 370
371 int depth = 100; 371 int depth = 50;
372 ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 372 ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
373 BindOnce(&NestingFunc, &depth)); 373 BindOnce(&NestingFunc, &depth));
374 RunLoop().Run(); 374 RunLoop().Run();
375 EXPECT_EQ(depth, 0); 375 EXPECT_EQ(depth, 0);
376 } 376 }
377 377
378 enum TaskType { 378 enum TaskType {
379 MESSAGEBOX, 379 MESSAGEBOX,
380 ENDDIALOG, 380 ENDDIALOG,
381 RECURSIVE, 381 RECURSIVE,
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 const int kNumTimes = 1 << 17; 986 const int kNumTimes = 1 << 17;
987 std::unique_ptr<MessagePump> pump(factory()); 987 std::unique_ptr<MessagePump> pump(factory());
988 MessageLoop loop(std::move(pump)); 988 MessageLoop loop(std::move(pump));
989 loop.task_runner()->PostTask(FROM_HERE, 989 loop.task_runner()->PostTask(FROM_HERE,
990 BindOnce(&PostNTasksThenQuit, kNumTimes)); 990 BindOnce(&PostNTasksThenQuit, kNumTimes));
991 RunLoop().Run(); 991 RunLoop().Run();
992 } 992 }
993 993
994 } // namespace test 994 } // namespace test
995 } // namespace base 995 } // namespace base
OLDNEW
« base/memory/weak_ptr.cc ('K') | « base/memory/weak_ptr.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698