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

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

Issue 461133002: Revert of Adds some CHECKs to MessagePumpMojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « no previous file | mojo/common/data_pipe_utils.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 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.h" 5 #include "base/message_loop/message_loop.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #endif // !defined(OS_NACL) 85 #endif // !defined(OS_NACL)
86 86
87 bool enable_histogrammer_ = false; 87 bool enable_histogrammer_ = false;
88 88
89 MessageLoop::MessagePumpFactory* message_pump_for_ui_factory_ = NULL; 89 MessageLoop::MessagePumpFactory* message_pump_for_ui_factory_ = NULL;
90 90
91 // Returns true if MessagePump::ScheduleWork() must be called one 91 // Returns true if MessagePump::ScheduleWork() must be called one
92 // time for every task that is added to the MessageLoop incoming queue. 92 // time for every task that is added to the MessageLoop incoming queue.
93 bool AlwaysNotifyPump(MessageLoop::Type type) { 93 bool AlwaysNotifyPump(MessageLoop::Type type) {
94 #if defined(OS_ANDROID) 94 #if defined(OS_ANDROID)
95 // The Android UI message loop needs to get notified each time a task is added
96 // to the incoming queue.
97 return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA; 95 return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA;
98 #else 96 #else
99 return false; 97 return false;
100 #endif 98 #endif
101 } 99 }
102 100
103 #if defined(OS_IOS) 101 #if defined(OS_IOS)
104 typedef MessagePumpIOSForIO MessagePumpForIO; 102 typedef MessagePumpIOSForIO MessagePumpForIO;
105 #elif defined(OS_NACL) 103 #elif defined(OS_NACL)
106 typedef MessagePumpDefault MessagePumpForIO; 104 typedef MessagePumpDefault MessagePumpForIO;
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 void MessageLoop::ReloadWorkQueue() { 521 void MessageLoop::ReloadWorkQueue() {
524 // We can improve performance of our loading tasks from the incoming queue to 522 // We can improve performance of our loading tasks from the incoming queue to
525 // |*work_queue| by waiting until the last minute (|*work_queue| is empty) to 523 // |*work_queue| by waiting until the last minute (|*work_queue| is empty) to
526 // load. That reduces the number of locks-per-task significantly when our 524 // load. That reduces the number of locks-per-task significantly when our
527 // queues get large. 525 // queues get large.
528 if (work_queue_.empty()) 526 if (work_queue_.empty())
529 incoming_task_queue_->ReloadWorkQueue(&work_queue_); 527 incoming_task_queue_->ReloadWorkQueue(&work_queue_);
530 } 528 }
531 529
532 void MessageLoop::ScheduleWork(bool was_empty) { 530 void MessageLoop::ScheduleWork(bool was_empty) {
531 // The Android UI message loop needs to get notified each time
532 // a task is added to the incoming queue.
533 if (was_empty || AlwaysNotifyPump(type_)) 533 if (was_empty || AlwaysNotifyPump(type_))
534 pump_->ScheduleWork(); 534 pump_->ScheduleWork();
535 } 535 }
536 536
537 //------------------------------------------------------------------------------ 537 //------------------------------------------------------------------------------
538 // Method and data for histogramming events and actions taken by each instance 538 // Method and data for histogramming events and actions taken by each instance
539 // on each thread. 539 // on each thread.
540 540
541 void MessageLoop::StartHistogrammer() { 541 void MessageLoop::StartHistogrammer() {
542 #if !defined(OS_NACL) // NaCl build has no metrics code. 542 #if !defined(OS_NACL) // NaCl build has no metrics code.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 persistent, 727 persistent,
728 mode, 728 mode,
729 controller, 729 controller,
730 delegate); 730 delegate);
731 } 731 }
732 #endif 732 #endif
733 733
734 #endif // !defined(OS_NACL) 734 #endif // !defined(OS_NACL)
735 735
736 } // namespace base 736 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | mojo/common/data_pipe_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698