OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/chromeos/login/user_image_loader.h" | 5 #include "chrome/browser/chromeos/login/user_image_loader.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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 const LoadedCallback& loaded_cb) { | 44 const LoadedCallback& loaded_cb) { |
45 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 45 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
46 SequenceToken sequence_token = pool->GetSequenceToken(); | 46 SequenceToken sequence_token = pool->GetSequenceToken(); |
47 Start(filepath, size, sequence_token, loaded_cb); | 47 Start(filepath, size, sequence_token, loaded_cb); |
48 } | 48 } |
49 | 49 |
50 void UserImageLoader::Start(const std::string& filepath, | 50 void UserImageLoader::Start(const std::string& filepath, |
51 int size, | 51 int size, |
52 const SequenceToken& token, | 52 const SequenceToken& token, |
53 const LoadedCallback& loaded_cb) { | 53 const LoadedCallback& loaded_cb) { |
54 target_message_loop_ = MessageLoop::current(); | 54 target_message_loop_ = base::MessageLoop::current(); |
55 | 55 |
56 ImageInfo image_info(size, loaded_cb); | 56 ImageInfo image_info(size, loaded_cb); |
57 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 57 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
58 scoped_refptr<base::SequencedTaskRunner> task_runner = pool-> | 58 scoped_refptr<base::SequencedTaskRunner> task_runner = pool-> |
59 GetSequencedTaskRunnerWithShutdownBehavior(token, | 59 GetSequencedTaskRunnerWithShutdownBehavior(token, |
60 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 60 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
61 task_runner->PostTask( | 61 task_runner->PostTask( |
62 FROM_HERE, | 62 FROM_HERE, |
63 base::Bind(&UserImageLoader::LoadImage, this, filepath, image_info, | 63 base::Bind(&UserImageLoader::LoadImage, this, filepath, image_info, |
64 task_runner)); | 64 task_runner)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 new ImageInfo(info_it->second.size, info_it->second.loaded_cb)); | 146 new ImageInfo(info_it->second.size, info_it->second.loaded_cb)); |
147 image_info_map_.erase(decoder); | 147 image_info_map_.erase(decoder); |
148 } | 148 } |
149 | 149 |
150 target_message_loop_->PostTask( | 150 target_message_loop_->PostTask( |
151 FROM_HERE, | 151 FROM_HERE, |
152 base::Bind(image_info->loaded_cb, UserImage())); | 152 base::Bind(image_info->loaded_cb, UserImage())); |
153 } | 153 } |
154 | 154 |
155 } // namespace chromeos | 155 } // namespace chromeos |
OLD | NEW |