| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/ssl/channel_id_service.h" | 5 #include "net/ssl/channel_id_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // Starts the worker asynchronously. | 113 // Starts the worker asynchronously. |
| 114 void Start(const scoped_refptr<base::TaskRunner>& task_runner) { | 114 void Start(const scoped_refptr<base::TaskRunner>& task_runner) { |
| 115 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread()); | 115 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread()); |
| 116 | 116 |
| 117 auto callback = base::Bind(&ChannelIDServiceWorker::Run, base::Owned(this)); | 117 auto callback = base::Bind(&ChannelIDServiceWorker::Run, base::Owned(this)); |
| 118 | 118 |
| 119 if (task_runner) { | 119 if (task_runner) { |
| 120 task_runner->PostTask(FROM_HERE, callback); | 120 task_runner->PostTask(FROM_HERE, callback); |
| 121 } else { | 121 } else { |
| 122 base::PostTaskWithTraits( | 122 base::PostTaskWithTraits( |
| 123 FROM_HERE, base::TaskTraits() | 123 FROM_HERE, |
| 124 .WithShutdownBehavior( | 124 {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
| 125 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | |
| 126 .MayBlock(), | |
| 127 callback); | 125 callback); |
| 128 } | 126 } |
| 129 } | 127 } |
| 130 | 128 |
| 131 private: | 129 private: |
| 132 void Run() { | 130 void Run() { |
| 133 // Runs on a worker thread. | 131 // Runs on a worker thread. |
| 134 int error = ERR_FAILED; | 132 int error = ERR_FAILED; |
| 135 std::unique_ptr<ChannelIDStore::ChannelID> channel_id = | 133 std::unique_ptr<ChannelIDStore::ChannelID> channel_id = |
| 136 GenerateChannelID(server_identifier_, &error); | 134 GenerateChannelID(server_identifier_, &error); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 } | 475 } |
| 478 | 476 |
| 479 return err; | 477 return err; |
| 480 } | 478 } |
| 481 | 479 |
| 482 int ChannelIDService::channel_id_count() { | 480 int ChannelIDService::channel_id_count() { |
| 483 return channel_id_store_->GetChannelIDCount(); | 481 return channel_id_store_->GetChannelIDCount(); |
| 484 } | 482 } |
| 485 | 483 |
| 486 } // namespace net | 484 } // namespace net |
| OLD | NEW |