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

Side by Side Diff: chrome/browser/chromeos/login/ownership_status_checker.cc

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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 | « base/threading/thread.cc ('k') | chrome/browser/icon_loader.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ownership_status_checker.h" 5 #include "chrome/browser/chromeos/login/ownership_status_checker.h"
6 6
7 #include "content/browser/browser_thread.h" 7 #include "content/browser/browser_thread.h"
8 8
9 namespace chromeos { 9 namespace chromeos {
10 10
11 OwnershipStatusChecker::OwnershipStatusChecker(Callback* callback) 11 OwnershipStatusChecker::OwnershipStatusChecker(Callback* callback)
12 : core_(new Core(callback)) { 12 : core_(new Core(callback)) {
13 core_->Check(); 13 core_->Check();
14 } 14 }
15 15
16 OwnershipStatusChecker::~OwnershipStatusChecker() { 16 OwnershipStatusChecker::~OwnershipStatusChecker() {
17 core_->Cancel(); 17 core_->Cancel();
18 } 18 }
19 19
20 OwnershipStatusChecker::Core::Core(Callback* callback) 20 OwnershipStatusChecker::Core::Core(Callback* callback)
21 : callback_(callback), 21 : callback_(callback),
22 origin_loop_(base::MessageLoopProxy::CreateForCurrentThread()) { 22 origin_loop_(base::MessageLoopProxy::current()) {
23 } 23 }
24 24
25 OwnershipStatusChecker::Core::~Core() {} 25 OwnershipStatusChecker::Core::~Core() {}
26 26
27 void OwnershipStatusChecker::Core::Check() { 27 void OwnershipStatusChecker::Core::Check() {
28 DCHECK(origin_loop_->BelongsToCurrentThread()); 28 DCHECK(origin_loop_->BelongsToCurrentThread());
29 OwnershipService::Status status = 29 OwnershipService::Status status =
30 OwnershipService::GetSharedInstance()->GetStatus(false); 30 OwnershipService::GetSharedInstance()->GetStatus(false);
31 if (status != OwnershipService::OWNERSHIP_UNKNOWN) { 31 if (status != OwnershipService::OWNERSHIP_UNKNOWN) {
32 // Take a spin on the message loop in order to avoid reentrancy in callers. 32 // Take a spin on the message loop in order to avoid reentrancy in callers.
(...skipping 30 matching lines...) Expand all
63 void OwnershipStatusChecker::Core::ReportResult( 63 void OwnershipStatusChecker::Core::ReportResult(
64 OwnershipService::Status status) { 64 OwnershipService::Status status) {
65 DCHECK(origin_loop_->BelongsToCurrentThread()); 65 DCHECK(origin_loop_->BelongsToCurrentThread());
66 if (callback_.get()) { 66 if (callback_.get()) {
67 callback_->Run(status); 67 callback_->Run(status);
68 callback_.reset(); 68 callback_.reset();
69 } 69 }
70 } 70 }
71 71
72 } // namespace chromeos 72 } // namespace chromeos
OLDNEW
« no previous file with comments | « base/threading/thread.cc ('k') | chrome/browser/icon_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698