| Index: base/message_loop.h
|
| diff --git a/base/message_loop.h b/base/message_loop.h
|
| index e14baa7b54d3846f80efb915996d2c03812b1fd2..f940502ef87cc5d1c01fa36ae83a0e80cf2317dc 100644
|
| --- a/base/message_loop.h
|
| +++ b/base/message_loop.h
|
| @@ -67,11 +67,12 @@ class Histogram;
|
| // (DoDragDrop), printer functions (StartDoc) and *many* others.
|
| //
|
| // Sample workaround when inner task processing is needed:
|
| -// bool old_state = MessageLoop::current()->NestableTasksAllowed();
|
| -// MessageLoop::current()->SetNestableTasksAllowed(true);
|
| -// HRESULT hr = DoDragDrop(...); // Implicitly runs a modal message loop here.
|
| -// MessageLoop::current()->SetNestableTasksAllowed(old_state);
|
| -// // Process hr (the result returned by DoDragDrop().
|
| +// HRESULT hr;
|
| +// {
|
| +// MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
|
| +// hr = DoDragDrop(...); // Implicitly runs a modal message loop.
|
| +// }
|
| +// // Process |hr| (the result returned by DoDragDrop()).
|
| //
|
| // Please be SURE your task is reentrant (nestable) and all global variables
|
| // are stable and accessible before calling SetNestableTasksAllowed(true).
|
| @@ -264,6 +265,10 @@ class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate {
|
| // using common controls or printer functions. By default, recursive task
|
| // processing is disabled.
|
| //
|
| + // Please utilize |ScopedNestableTaskAllower| instead of calling these methods
|
| + // directly. In general nestable message loops are to be avoided. They are
|
| + // dangerous and difficult to get right, so please use with extreme caution.
|
| + //
|
| // The specific case where tasks get queued is:
|
| // - The thread is running a message loop.
|
| // - It receives a task #1 and execute it.
|
|
|