OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/download/drag_download_file.h" | 5 #include "content/browser/download/drag_download_file.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "content/browser/download/download_stats.h" | 10 #include "content/browser/download/download_stats.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // Only do the check on Windows where two threads are involved. | 216 // Only do the check on Windows where two threads are involved. |
217 #if defined(OS_WIN) | 217 #if defined(OS_WIN) |
218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
219 #endif | 219 #endif |
220 } | 220 } |
221 | 221 |
222 #if defined(OS_WIN) | 222 #if defined(OS_WIN) |
223 void DragDownloadFile::StartNestedMessageLoop() { | 223 void DragDownloadFile::StartNestedMessageLoop() { |
224 AssertCurrentlyOnDragThread(); | 224 AssertCurrentlyOnDragThread(); |
225 | 225 |
226 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 226 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
227 MessageLoop::current()->SetNestableTasksAllowed(true); | |
228 is_running_nested_message_loop_ = true; | 227 is_running_nested_message_loop_ = true; |
229 MessageLoop::current()->Run(); | 228 MessageLoop::current()->Run(); |
230 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 229 DCHECK(!is_running_nested_message_loop_); |
231 } | 230 } |
232 | 231 |
233 void DragDownloadFile::QuitNestedMessageLoop() { | 232 void DragDownloadFile::QuitNestedMessageLoop() { |
234 AssertCurrentlyOnDragThread(); | 233 AssertCurrentlyOnDragThread(); |
235 | 234 |
236 if (is_running_nested_message_loop_) { | 235 if (is_running_nested_message_loop_) { |
237 is_running_nested_message_loop_ = false; | 236 is_running_nested_message_loop_ = false; |
238 MessageLoop::current()->Quit(); | 237 MessageLoop::current()->Quit(); |
239 } | 238 } |
240 } | 239 } |
241 #endif | 240 #endif |
OLD | NEW |