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 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 5 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if (!profile_path.empty()) | 88 if (!profile_path.empty()) |
89 data_path = profile_path.Append(local_partition_path); | 89 data_path = profile_path.Append(local_partition_path); |
90 | 90 |
91 scoped_refptr<base::SequencedTaskRunner> primary_sequence; | 91 scoped_refptr<base::SequencedTaskRunner> primary_sequence; |
92 scoped_refptr<base::SequencedTaskRunner> commit_sequence; | 92 scoped_refptr<base::SequencedTaskRunner> commit_sequence; |
93 if (GetContentClient()->browser()->ShouldRedirectDOMStorageTaskRunner()) { | 93 if (GetContentClient()->browser()->ShouldRedirectDOMStorageTaskRunner()) { |
94 // TaskPriority::USER_BLOCKING as an experiment because this is currently | 94 // TaskPriority::USER_BLOCKING as an experiment because this is currently |
95 // believed to be blocking synchronous IPCs from the renderers: | 95 // believed to be blocking synchronous IPCs from the renderers: |
96 // http://crbug.com/665588 (yes we want to fix that bug, but are taking it | 96 // http://crbug.com/665588 (yes we want to fix that bug, but are taking it |
97 // as an opportunity to experiment with the scheduler). | 97 // as an opportunity to experiment with the scheduler). |
98 base::TaskTraits dom_storage_traits = | 98 base::TaskTraits dom_storage_traits = { |
99 base::TaskTraits() | 99 base::MayBlock(), base::TaskPriority::USER_BLOCKING, |
100 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN) | 100 base::TaskShutdownBehavior::BLOCK_SHUTDOWN}; |
101 .MayBlock() | |
102 .WithPriority(base::TaskPriority::USER_BLOCKING); | |
103 primary_sequence = | 101 primary_sequence = |
104 base::CreateSequencedTaskRunnerWithTraits(dom_storage_traits); | 102 base::CreateSequencedTaskRunnerWithTraits(dom_storage_traits); |
105 commit_sequence = | 103 commit_sequence = |
106 base::CreateSequencedTaskRunnerWithTraits(dom_storage_traits); | 104 base::CreateSequencedTaskRunnerWithTraits(dom_storage_traits); |
107 } else { | 105 } else { |
108 base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool(); | 106 base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool(); |
109 primary_sequence = worker_pool->GetSequencedTaskRunner( | 107 primary_sequence = worker_pool->GetSequencedTaskRunner( |
110 worker_pool->GetNamedSequenceToken("dom_storage_primary")); | 108 worker_pool->GetNamedSequenceToken("dom_storage_primary")); |
111 commit_sequence = worker_pool->GetSequencedTaskRunner( | 109 commit_sequence = worker_pool->GetSequencedTaskRunner( |
112 worker_pool->GetNamedSequenceToken("dom_storage_commit")); | 110 worker_pool->GetNamedSequenceToken("dom_storage_commit")); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 GetLocalStorageUsageCallback callback, | 291 GetLocalStorageUsageCallback callback, |
294 std::vector<LocalStorageUsageInfo> usage) { | 292 std::vector<LocalStorageUsageInfo> usage) { |
295 context_->task_runner()->PostShutdownBlockingTask( | 293 context_->task_runner()->PostShutdownBlockingTask( |
296 FROM_HERE, DOMStorageTaskRunner::PRIMARY_SEQUENCE, | 294 FROM_HERE, DOMStorageTaskRunner::PRIMARY_SEQUENCE, |
297 base::Bind(&GetLocalStorageUsageHelper, base::Passed(&usage), | 295 base::Bind(&GetLocalStorageUsageHelper, base::Passed(&usage), |
298 base::RetainedRef(base::ThreadTaskRunnerHandle::Get()), | 296 base::RetainedRef(base::ThreadTaskRunnerHandle::Get()), |
299 base::RetainedRef(context_), callback)); | 297 base::RetainedRef(context_), callback)); |
300 } | 298 } |
301 | 299 |
302 } // namespace content | 300 } // namespace content |
OLD | NEW |