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

Side by Side Diff: chrome/browser/sync/glue/ui_model_worker.cc

Issue 3859003: FBTF: Even more ctor/virtual deinlining. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/sync/glue/ui_model_worker.h" 5 #include "chrome/browser/sync/glue/ui_model_worker.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 8 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
9 #include "base/waitable_event.h" 9 #include "base/waitable_event.h"
10 10
(...skipping 23 matching lines...) Expand all
34 // The task is owned by the message loop as per usual. 34 // The task is owned by the message loop as per usual.
35 AutoLock lock(lock_); 35 AutoLock lock(lock_);
36 DCHECK(!pending_work_); 36 DCHECK(!pending_work_);
37 pending_work_ = new CallDoWorkAndSignalTask(work, &work_done, this); 37 pending_work_ = new CallDoWorkAndSignalTask(work, &work_done, this);
38 ui_loop_->PostTask(FROM_HERE, pending_work_); 38 ui_loop_->PostTask(FROM_HERE, pending_work_);
39 } 39 }
40 syncapi_event_.Signal(); // Notify that the syncapi produced work for us. 40 syncapi_event_.Signal(); // Notify that the syncapi produced work for us.
41 work_done.Wait(); 41 work_done.Wait();
42 } 42 }
43 43
44 UIModelWorker::UIModelWorker(MessageLoop* ui_loop)
45 : state_(WORKING),
46 pending_work_(NULL),
47 syncapi_has_shutdown_(false),
48 ui_loop_(ui_loop),
49 syncapi_event_(&lock_) {
50 }
51
44 UIModelWorker::~UIModelWorker() { 52 UIModelWorker::~UIModelWorker() {
45 DCHECK_EQ(state_, STOPPED); 53 DCHECK_EQ(state_, STOPPED);
46 } 54 }
47 55
48 void UIModelWorker::OnSyncerShutdownComplete() { 56 void UIModelWorker::OnSyncerShutdownComplete() {
49 AutoLock lock(lock_); 57 AutoLock lock(lock_);
50 // The SyncerThread has terminated and we are no longer needed by syncapi. 58 // The SyncerThread has terminated and we are no longer needed by syncapi.
51 // The UI loop initiated shutdown and is (or will be) waiting in Stop(). 59 // The UI loop initiated shutdown and is (or will be) waiting in Stop().
52 // We could either be WORKING or RUNNING_MANUAL_SHUTDOWN_PUMP, depending 60 // We could either be WORKING or RUNNING_MANUAL_SHUTDOWN_PUMP, depending
53 // on where we timeslice the UI thread in Stop; but we can't be STOPPED, 61 // on where we timeslice the UI thread in Stop; but we can't be STOPPED,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // get run twice. 111 // get run twice.
104 work_ = NULL; 112 work_ = NULL;
105 113
106 // Notify the UIModelWorker that scheduled us that we have run 114 // Notify the UIModelWorker that scheduled us that we have run
107 // successfully. 115 // successfully.
108 scheduler_->OnTaskCompleted(); 116 scheduler_->OnTaskCompleted();
109 work_done_->Signal(); // Unblock the syncer thread that scheduled us. 117 work_done_->Signal(); // Unblock the syncer thread that scheduled us.
110 } 118 }
111 119
112 } // namespace browser_sync 120 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698