OLD | NEW |
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 |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 // If |type| is TYPE_CUSTOM non-null |pump_factory| must be also given | 408 // If |type| is TYPE_CUSTOM non-null |pump_factory| must be also given |
409 // to create a message pump for this message loop. Otherwise a default | 409 // to create a message pump for this message loop. Otherwise a default |
410 // message pump for the |type| is created. | 410 // message pump for the |type| is created. |
411 // | 411 // |
412 // It is valid to call this to create a new message loop on one thread, | 412 // It is valid to call this to create a new message loop on one thread, |
413 // and then pass it to the thread where the message loop actually runs. | 413 // and then pass it to the thread where the message loop actually runs. |
414 // The message loop's BindToCurrentThread() method must be called on the | 414 // The message loop's BindToCurrentThread() method must be called on the |
415 // thread the message loop runs on, before calling Run(). | 415 // thread the message loop runs on, before calling Run(). |
416 // Before BindToCurrentThread() is called only Post*Task() functions can | 416 // Before BindToCurrentThread() is called only Post*Task() functions can |
417 // be called on the message loop. | 417 // be called on the message loop. |
418 scoped_ptr<MessageLoop> CreateUnbound( | 418 static scoped_ptr<MessageLoop> CreateUnbound( |
419 Type type, | 419 Type type, |
420 MessagePumpFactoryCallback pump_factory); | 420 MessagePumpFactoryCallback pump_factory); |
421 | 421 |
422 // Common private constructor. Other constructors delegate the initialization | 422 // Common private constructor. Other constructors delegate the initialization |
423 // to this constructor. | 423 // to this constructor. |
424 MessageLoop(Type type, MessagePumpFactoryCallback pump_factory); | 424 MessageLoop(Type type, MessagePumpFactoryCallback pump_factory); |
425 | 425 |
426 // Configure various members and bind this message loop to the current thread. | 426 // Configure various members and bind this message loop to the current thread. |
427 void BindToCurrentThread(); | 427 void BindToCurrentThread(); |
428 | 428 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 674 |
675 // Do not add any member variables to MessageLoopForIO! This is important b/c | 675 // Do not add any member variables to MessageLoopForIO! This is important b/c |
676 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 676 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
677 // data that you need should be stored on the MessageLoop's pump_ instance. | 677 // data that you need should be stored on the MessageLoop's pump_ instance. |
678 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 678 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
679 MessageLoopForIO_should_not_have_extra_member_variables); | 679 MessageLoopForIO_should_not_have_extra_member_variables); |
680 | 680 |
681 } // namespace base | 681 } // namespace base |
682 | 682 |
683 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 683 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |