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

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

Issue 1559353002: base: Fix DCHECK when thread creation fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak assert. Created 4 years, 11 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
« no previous file with comments | « no previous file | base/message_loop/message_loop.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 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
11 #include "base/base_export.h" 11 #include "base/base_export.h"
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/debug/task_annotator.h" 13 #include "base/debug/task_annotator.h"
14 #include "base/gtest_prod_util.h"
14 #include "base/location.h" 15 #include "base/location.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
18 #include "base/message_loop/incoming_task_queue.h" 19 #include "base/message_loop/incoming_task_queue.h"
19 #include "base/message_loop/message_loop_task_runner.h" 20 #include "base/message_loop/message_loop_task_runner.h"
20 #include "base/message_loop/message_pump.h" 21 #include "base/message_loop/message_pump.h"
21 #include "base/message_loop/timer_slack.h" 22 #include "base/message_loop/timer_slack.h"
22 #include "base/observer_list.h" 23 #include "base/observer_list.h"
23 #include "base/pending_task.h" 24 #include "base/pending_task.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 397
397 //---------------------------------------------------------------------------- 398 //----------------------------------------------------------------------------
398 protected: 399 protected:
399 scoped_ptr<MessagePump> pump_; 400 scoped_ptr<MessagePump> pump_;
400 401
401 private: 402 private:
402 friend class RunLoop; 403 friend class RunLoop;
403 friend class internal::IncomingTaskQueue; 404 friend class internal::IncomingTaskQueue;
404 friend class ScheduleWorkTest; 405 friend class ScheduleWorkTest;
405 friend class Thread; 406 friend class Thread;
407 FRIEND_TEST_ALL_PREFIXES(MessageLoopTest, DeleteUnboundLoop);
406 408
407 using MessagePumpFactoryCallback = Callback<scoped_ptr<MessagePump>()>; 409 using MessagePumpFactoryCallback = Callback<scoped_ptr<MessagePump>()>;
408 410
409 // Creates a MessageLoop without binding to a thread. 411 // Creates a MessageLoop without binding to a thread.
410 // If |type| is TYPE_CUSTOM non-null |pump_factory| must be also given 412 // If |type| is TYPE_CUSTOM non-null |pump_factory| must be also given
411 // to create a message pump for this message loop. Otherwise a default 413 // to create a message pump for this message loop. Otherwise a default
412 // message pump for the |type| is created. 414 // message pump for the |type| is created.
413 // 415 //
414 // It is valid to call this to create a new message loop on one thread, 416 // It is valid to call this to create a new message loop on one thread,
415 // and then pass it to the thread where the message loop actually runs. 417 // and then pass it to the thread where the message loop actually runs.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 684
683 // Do not add any member variables to MessageLoopForIO! This is important b/c 685 // Do not add any member variables to MessageLoopForIO! This is important b/c
684 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 686 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
685 // data that you need should be stored on the MessageLoop's pump_ instance. 687 // data that you need should be stored on the MessageLoop's pump_ instance.
686 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 688 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
687 "MessageLoopForIO should not have extra member variables"); 689 "MessageLoopForIO should not have extra member variables");
688 690
689 } // namespace base 691 } // namespace base
690 692
691 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 693 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « no previous file | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698