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

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

Issue 454433003: Adds some CHECKs to MessagePumpMojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix 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.
95 return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA; 97 return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA;
96 #else 98 #else
97 return false; 99 return false;
98 #endif 100 #endif
99 } 101 }
100 102
101 #if defined(OS_IOS) 103 #if defined(OS_IOS)
102 typedef MessagePumpIOSForIO MessagePumpForIO; 104 typedef MessagePumpIOSForIO MessagePumpForIO;
103 #elif defined(OS_NACL) 105 #elif defined(OS_NACL)
104 typedef MessagePumpDefault MessagePumpForIO; 106 typedef MessagePumpDefault MessagePumpForIO;
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 void MessageLoop::ReloadWorkQueue() { 523 void MessageLoop::ReloadWorkQueue() {
522 // We can improve performance of our loading tasks from the incoming queue to 524 // We can improve performance of our loading tasks from the incoming queue to
523 // |*work_queue| by waiting until the last minute (|*work_queue| is empty) to 525 // |*work_queue| by waiting until the last minute (|*work_queue| is empty) to
524 // load. That reduces the number of locks-per-task significantly when our 526 // load. That reduces the number of locks-per-task significantly when our
525 // queues get large. 527 // queues get large.
526 if (work_queue_.empty()) 528 if (work_queue_.empty())
527 incoming_task_queue_->ReloadWorkQueue(&work_queue_); 529 incoming_task_queue_->ReloadWorkQueue(&work_queue_);
528 } 530 }
529 531
530 void MessageLoop::ScheduleWork(bool was_empty) { 532 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 persistent, 717 persistent,
718 mode, 718 mode,
719 controller, 719 controller,
720 delegate); 720 delegate);
721 } 721 }
722 #endif 722 #endif
723 723
724 #endif // !defined(OS_NACL) 724 #endif // !defined(OS_NACL)
725 725
726 } // namespace base 726 } // 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