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

Side by Side Diff: chrome/browser/platform_util.cc

Issue 1912303002: OpenItem now posts its task with CONTINUE_ON_SHUTDOWN semantic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_delayed_analysis
Patch Set: Created 4 years, 8 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/platform_util.h" 5 #include "chrome/browser/platform_util.h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/browser_hangs_experiment.h"
10 #include "chrome/browser/platform_util_internal.h" 11 #include "chrome/browser/platform_util_internal.h"
11 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
12 13
13 using content::BrowserThread; 14 using content::BrowserThread;
14 15
15 namespace platform_util { 16 namespace platform_util {
16 17
17 namespace { 18 namespace {
18 19
19 bool shell_operations_allowed = true; 20 bool shell_operations_allowed = true;
(...skipping 11 matching lines...) Expand all
31 if (base::DirectoryExists(path) != (type == OPEN_FOLDER)) { 32 if (base::DirectoryExists(path) != (type == OPEN_FOLDER)) {
32 if (!callback.is_null()) 33 if (!callback.is_null())
33 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 34 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
34 base::Bind(callback, OPEN_FAILED_INVALID_TYPE)); 35 base::Bind(callback, OPEN_FAILED_INVALID_TYPE));
35 return; 36 return;
36 } 37 }
37 38
38 if (shell_operations_allowed) 39 if (shell_operations_allowed)
39 internal::PlatformOpenVerifiedItem(path, type); 40 internal::PlatformOpenVerifiedItem(path, type);
40 if (!callback.is_null()) 41 if (!callback.is_null())
41 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 42 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
manzagop (departed) 2016/04/25 14:28:26 Is it an issue to post a task from a continue on s
Patrick Monette 2016/04/28 20:22:09 Lets ask gab@!
gab 2016/04/28 22:36:25 It shouldn't be: - for BrowserThread MessageLoop
42 base::Bind(callback, OPEN_SUCCEEDED)); 43 base::Bind(callback, OPEN_SUCCEEDED));
43 } 44 }
44 45
45 } // namespace 46 } // namespace
46 47
47 namespace internal { 48 namespace internal {
48 49
49 void DisableShellOperationsForTesting() { 50 void DisableShellOperationsForTesting() {
50 shell_operations_allowed = false; 51 shell_operations_allowed = false;
51 } 52 }
52 53
53 } // namespace internal 54 } // namespace internal
54 55
55 void OpenItem(Profile* profile, 56 void OpenItem(Profile* profile,
56 const base::FilePath& full_path, 57 const base::FilePath& full_path,
57 OpenItemType item_type, 58 OpenItemType item_type,
58 const OpenOperationCallback& callback) { 59 const OpenOperationCallback& callback) {
59 DCHECK_CURRENTLY_ON(BrowserThread::UI); 60 DCHECK_CURRENTLY_ON(BrowserThread::UI);
60 BrowserThread::PostBlockingPoolTask( 61 base::SequencedWorkerPool::WorkerShutdown shutdown_mode =
62 IsBrowserHangsExperimentEnabled()
63 ? base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN
64 : base::SequencedWorkerPool::SKIP_ON_SHUTDOWN;
65 BrowserThread::GetBlockingPool()->PostWorkerTaskWithShutdownBehavior(
61 FROM_HERE, base::Bind(&VerifyAndOpenItemOnBlockingThread, full_path, 66 FROM_HERE, base::Bind(&VerifyAndOpenItemOnBlockingThread, full_path,
62 item_type, callback)); 67 item_type, callback),
68 shutdown_mode);
63 } 69 }
64 70
65 } // namespace platform_util 71 } // namespace platform_util
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698