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

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

Issue 5741001: Even more virtual method deinlining. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase (windows) Created 10 years 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 | « chrome/browser/sync/glue/ui_model_worker.h ('k') | chrome/browser/sync/profile_sync_service.h » ('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) 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (pending_work_) 82 if (pending_work_)
83 pending_work_->Run(); // OnTaskCompleted will set pending_work_ to NULL. 83 pending_work_->Run(); // OnTaskCompleted will set pending_work_ to NULL.
84 84
85 // Wait for either a new task or SyncerThread termination. 85 // Wait for either a new task or SyncerThread termination.
86 syncapi_event_.Wait(); 86 syncapi_event_.Wait();
87 } 87 }
88 88
89 state_ = STOPPED; 89 state_ = STOPPED;
90 } 90 }
91 91
92 ModelSafeGroup UIModelWorker::GetModelSafeGroup() {
93 return GROUP_UI;
94 }
95
92 bool UIModelWorker::CurrentThreadIsWorkThread() { 96 bool UIModelWorker::CurrentThreadIsWorkThread() {
93 return MessageLoop::current() == ui_loop_; 97 return MessageLoop::current() == ui_loop_;
94 } 98 }
95 99
96 void UIModelWorker::CallDoWorkAndSignalTask::Run() { 100 void UIModelWorker::CallDoWorkAndSignalTask::Run() {
97 if (!work_) { 101 if (!work_) {
98 // This can happen during tests or cases where there are more than just the 102 // This can happen during tests or cases where there are more than just the
99 // default UIModelWorker in existence and it gets destroyed before 103 // default UIModelWorker in existence and it gets destroyed before
100 // the main UI loop has terminated. There is no easy way to assert the 104 // the main UI loop has terminated. There is no easy way to assert the
101 // loop is running / not running at the moment, so we just provide cancel 105 // loop is running / not running at the moment, so we just provide cancel
102 // semantics here and short-circuit. 106 // semantics here and short-circuit.
103 // TODO(timsteele): Maybe we should have the message loop destruction 107 // TODO(timsteele): Maybe we should have the message loop destruction
104 // observer fire when the loop has ended, just a bit before it 108 // observer fire when the loop has ended, just a bit before it
105 // actually gets destroyed. 109 // actually gets destroyed.
106 return; 110 return;
107 } 111 }
108 work_->Run(); 112 work_->Run();
109 113
110 // Sever ties with work_ to allow the sanity-checking above that we don't 114 // Sever ties with work_ to allow the sanity-checking above that we don't
111 // get run twice. 115 // get run twice.
112 work_ = NULL; 116 work_ = NULL;
113 117
114 // Notify the UIModelWorker that scheduled us that we have run 118 // Notify the UIModelWorker that scheduled us that we have run
115 // successfully. 119 // successfully.
116 scheduler_->OnTaskCompleted(); 120 scheduler_->OnTaskCompleted();
117 work_done_->Signal(); // Unblock the syncer thread that scheduled us. 121 work_done_->Signal(); // Unblock the syncer thread that scheduled us.
118 } 122 }
119 123
120 } // namespace browser_sync 124 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/ui_model_worker.h ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698