| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 RecordDeletionProbe(RecordDeletionProbe* post_on_delete, bool* was_deleted) | 429 RecordDeletionProbe(RecordDeletionProbe* post_on_delete, bool* was_deleted) |
| 430 : post_on_delete_(post_on_delete), was_deleted_(was_deleted) { | 430 : post_on_delete_(post_on_delete), was_deleted_(was_deleted) { |
| 431 } | 431 } |
| 432 void Run() {} | 432 void Run() {} |
| 433 | 433 |
| 434 private: | 434 private: |
| 435 friend class RefCounted<RecordDeletionProbe>; | 435 friend class RefCounted<RecordDeletionProbe>; |
| 436 | 436 |
| 437 ~RecordDeletionProbe() { | 437 ~RecordDeletionProbe() { |
| 438 *was_deleted_ = true; | 438 *was_deleted_ = true; |
| 439 if (post_on_delete_) | 439 if (post_on_delete_.get()) |
| 440 MessageLoop::current()->PostTask( | 440 MessageLoop::current()->PostTask( |
| 441 FROM_HERE, | 441 FROM_HERE, Bind(&RecordDeletionProbe::Run, post_on_delete_.get())); |
| 442 Bind(&RecordDeletionProbe::Run, post_on_delete_.get())); | |
| 443 } | 442 } |
| 444 | 443 |
| 445 scoped_refptr<RecordDeletionProbe> post_on_delete_; | 444 scoped_refptr<RecordDeletionProbe> post_on_delete_; |
| 446 bool* was_deleted_; | 445 bool* was_deleted_; |
| 447 }; | 446 }; |
| 448 | 447 |
| 449 void RunTest_EnsureDeletion(MessageLoop::Type message_loop_type) { | 448 void RunTest_EnsureDeletion(MessageLoop::Type message_loop_type) { |
| 450 bool a_was_deleted = false; | 449 bool a_was_deleted = false; |
| 451 bool b_was_deleted = false; | 450 bool b_was_deleted = false; |
| 452 { | 451 { |
| (...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 // On Linux, the pipe buffer size is 64KiB by default. The bug caused one | 2107 // On Linux, the pipe buffer size is 64KiB by default. The bug caused one |
| 2109 // byte accumulated in the pipe per two posts, so we should repeat 128K | 2108 // byte accumulated in the pipe per two posts, so we should repeat 128K |
| 2110 // times to reproduce the bug. | 2109 // times to reproduce the bug. |
| 2111 const int kNumTimes = 1 << 17; | 2110 const int kNumTimes = 1 << 17; |
| 2112 RunTest_RecursivePosts(MessageLoop::TYPE_DEFAULT, kNumTimes); | 2111 RunTest_RecursivePosts(MessageLoop::TYPE_DEFAULT, kNumTimes); |
| 2113 RunTest_RecursivePosts(MessageLoop::TYPE_UI, kNumTimes); | 2112 RunTest_RecursivePosts(MessageLoop::TYPE_UI, kNumTimes); |
| 2114 RunTest_RecursivePosts(MessageLoop::TYPE_IO, kNumTimes); | 2113 RunTest_RecursivePosts(MessageLoop::TYPE_IO, kNumTimes); |
| 2115 } | 2114 } |
| 2116 | 2115 |
| 2117 } // namespace base | 2116 } // namespace base |
| OLD | NEW |