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

Side by Side Diff: content/browser/download/drag_download_file.cc

Issue 9384024: Prefer ScopedNestableTaskAllower over manual save/restore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename back to "allow". Created 8 years, 10 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 | « chrome/test/base/ui_test_utils.cc ('k') | content/renderer/devtools_agent.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 (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
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
OLDNEW
« no previous file with comments | « chrome/test/base/ui_test_utils.cc ('k') | content/renderer/devtools_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698