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

Side by Side Diff: mojo/edk/system/core_test_base.cc

Issue 2060943007: Make it possible to remove an Awakable with a specific "context" from a Dispatcher. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « mojo/edk/system/core_test_base.h ('k') | mojo/edk/system/data_pipe.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "mojo/edk/system/core_test_base.h" 5 #include "mojo/edk/system/core_test_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 189
190 void RemoveAwakableImplNoLock(Awakable* /*awakable*/, 190 void RemoveAwakableImplNoLock(Awakable* /*awakable*/,
191 HandleSignalsState* signals_state) override { 191 HandleSignalsState* signals_state) override {
192 info_->IncrementRemoveAwakableCallCount(); 192 info_->IncrementRemoveAwakableCallCount();
193 mutex().AssertHeld(); 193 mutex().AssertHeld();
194 if (signals_state) 194 if (signals_state)
195 *signals_state = HandleSignalsState(); 195 *signals_state = HandleSignalsState();
196 } 196 }
197 197
198 void RemoveAwakableWithContextImplNoLock(
199 Awakable* /*awakable*/,
200 uint64_t /*context*/,
201 HandleSignalsState* signals_state) override {
202 info_->IncrementRemoveAwakableWithContextCallCount();
203 mutex().AssertHeld();
204 if (signals_state)
205 *signals_state = HandleSignalsState();
206 }
207
198 void CancelAllStateNoLock() override { 208 void CancelAllStateNoLock() override {
199 info_->IncrementCancelAllStateCallCount(); 209 info_->IncrementCancelAllStateCallCount();
200 mutex().AssertHeld(); 210 mutex().AssertHeld();
201 } 211 }
202 212
203 RefPtr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock( 213 RefPtr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock(
204 MessagePipe* /*message_pipe*/, 214 MessagePipe* /*message_pipe*/,
205 unsigned /*port*/) override { 215 unsigned /*port*/) override {
206 CancelAllStateNoLock(); 216 CancelAllStateNoLock();
207 return Create(info_); 217 return Create(info_);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 unsigned CoreTestBase_MockHandleInfo::GetAddAwakableCallCount() const { 343 unsigned CoreTestBase_MockHandleInfo::GetAddAwakableCallCount() const {
334 MutexLocker locker(&mutex_); 344 MutexLocker locker(&mutex_);
335 return add_awakable_call_count_; 345 return add_awakable_call_count_;
336 } 346 }
337 347
338 unsigned CoreTestBase_MockHandleInfo::GetRemoveAwakableCallCount() const { 348 unsigned CoreTestBase_MockHandleInfo::GetRemoveAwakableCallCount() const {
339 MutexLocker locker(&mutex_); 349 MutexLocker locker(&mutex_);
340 return remove_awakable_call_count_; 350 return remove_awakable_call_count_;
341 } 351 }
342 352
353 unsigned CoreTestBase_MockHandleInfo::GetRemoveAwakableWithContextCallCount()
354 const {
355 MutexLocker locker(&mutex_);
356 return remove_awakable_with_context_call_count_;
357 }
358
343 unsigned CoreTestBase_MockHandleInfo::GetCancelAllStateCallCount() const { 359 unsigned CoreTestBase_MockHandleInfo::GetCancelAllStateCallCount() const {
344 MutexLocker locker(&mutex_); 360 MutexLocker locker(&mutex_);
345 return cancel_all_awakables_call_count_; 361 return cancel_all_awakables_call_count_;
346 } 362 }
347 363
348 size_t CoreTestBase_MockHandleInfo::GetAddedAwakableSize() const { 364 size_t CoreTestBase_MockHandleInfo::GetAddedAwakableSize() const {
349 MutexLocker locker(&mutex_); 365 MutexLocker locker(&mutex_);
350 return added_awakables_.size(); 366 return added_awakables_.size();
351 } 367 }
352 368
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 void CoreTestBase_MockHandleInfo::IncrementAddAwakableCallCount() { 449 void CoreTestBase_MockHandleInfo::IncrementAddAwakableCallCount() {
434 MutexLocker locker(&mutex_); 450 MutexLocker locker(&mutex_);
435 add_awakable_call_count_++; 451 add_awakable_call_count_++;
436 } 452 }
437 453
438 void CoreTestBase_MockHandleInfo::IncrementRemoveAwakableCallCount() { 454 void CoreTestBase_MockHandleInfo::IncrementRemoveAwakableCallCount() {
439 MutexLocker locker(&mutex_); 455 MutexLocker locker(&mutex_);
440 remove_awakable_call_count_++; 456 remove_awakable_call_count_++;
441 } 457 }
442 458
459 void CoreTestBase_MockHandleInfo::
460 IncrementRemoveAwakableWithContextCallCount() {
461 MutexLocker locker(&mutex_);
462 remove_awakable_with_context_call_count_++;
463 }
464
443 void CoreTestBase_MockHandleInfo::IncrementCancelAllStateCallCount() { 465 void CoreTestBase_MockHandleInfo::IncrementCancelAllStateCallCount() {
444 MutexLocker locker(&mutex_); 466 MutexLocker locker(&mutex_);
445 cancel_all_awakables_call_count_++; 467 cancel_all_awakables_call_count_++;
446 } 468 }
447 469
448 void CoreTestBase_MockHandleInfo::AllowAddAwakable(bool alllow) { 470 void CoreTestBase_MockHandleInfo::AllowAddAwakable(bool alllow) {
449 MutexLocker locker(&mutex_); 471 MutexLocker locker(&mutex_);
450 add_awakable_allowed_ = alllow; 472 add_awakable_allowed_ = alllow;
451 } 473 }
452 474
453 bool CoreTestBase_MockHandleInfo::IsAddAwakableAllowed() const { 475 bool CoreTestBase_MockHandleInfo::IsAddAwakableAllowed() const {
454 MutexLocker locker(&mutex_); 476 MutexLocker locker(&mutex_);
455 return add_awakable_allowed_; 477 return add_awakable_allowed_;
456 } 478 }
457 479
458 void CoreTestBase_MockHandleInfo::AwakableWasAdded(Awakable* awakable) { 480 void CoreTestBase_MockHandleInfo::AwakableWasAdded(Awakable* awakable) {
459 MutexLocker locker(&mutex_); 481 MutexLocker locker(&mutex_);
460 added_awakables_.push_back(awakable); 482 added_awakables_.push_back(awakable);
461 } 483 }
462 484
463 } // namespace test 485 } // namespace test
464 } // namespace system 486 } // namespace system
465 } // namespace mojo 487 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/core_test_base.h ('k') | mojo/edk/system/data_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698