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

Side by Side Diff: chrome/browser/task_manager/sampling/shared_sampler_win.cc

Issue 2612773004: Removed errorneous DCHECK from TaskManager SharedSampler code (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/task_manager/sampling/shared_sampler.h" 5 #include "chrome/browser/task_manager/sampling/shared_sampler.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <winternl.h> 8 #include <winternl.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 return; 362 return;
363 363
364 DCHECK(callbacks_map_.find(process_id) != callbacks_map_.end()); 364 DCHECK(callbacks_map_.find(process_id) != callbacks_map_.end());
365 365
366 if (refresh_flags_ == 0) { 366 if (refresh_flags_ == 0) {
367 base::PostTaskAndReplyWithResult( 367 base::PostTaskAndReplyWithResult(
368 blocking_pool_runner_.get(), FROM_HERE, 368 blocking_pool_runner_.get(), FROM_HERE,
369 base::Bind(&SharedSampler::RefreshOnWorkerThread, this), 369 base::Bind(&SharedSampler::RefreshOnWorkerThread, this),
370 base::Bind(&SharedSampler::OnRefreshDone, this)); 370 base::Bind(&SharedSampler::OnRefreshDone, this));
371 } else { 371 } else {
372 // http://crbug.com/678471
372 // A group of consecutive Refresh calls should all specify the same refresh 373 // A group of consecutive Refresh calls should all specify the same refresh
373 // flags. 374 // flags. Rarely RefreshOnWorkerThread could take a long time (> 1 sec),
374 DCHECK_EQ(refresh_flags, refresh_flags_); 375 // long enough for a next refresh cycle to start before results are ready
376 // from a previous cycle. In that case refresh_flags_ would still remain
377 // set to the previous cycle refresh flags which might be different than
378 // this cycle refresh flags if a column was added or removed between the two
379 // cycles. The worst that could happen in that condition is that results for
380 // a newly added column would be missing for one extra refresh cycle.
375 } 381 }
376 382
377 refresh_flags_ |= refresh_flags; 383 refresh_flags_ |= refresh_flags;
378 } 384 }
379 385
380 void SharedSampler::ClearState() { 386 void SharedSampler::ClearState() {
381 previous_snapshot_.reset(); 387 previous_snapshot_.reset();
382 } 388 }
383 389
384 std::unique_ptr<SharedSampler::RefreshResults> 390 std::unique_ptr<SharedSampler::RefreshResults>
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 callback_entry.second.on_physical_memory.Run(physical_bytes); 636 callback_entry.second.on_physical_memory.Run(physical_bytes);
631 } 637 }
632 } 638 }
633 639
634 // Reset refresh_results_ to trigger RefreshOnWorkerThread next time Refresh 640 // Reset refresh_results_ to trigger RefreshOnWorkerThread next time Refresh
635 // is called. 641 // is called.
636 refresh_flags_ = 0; 642 refresh_flags_ = 0;
637 } 643 }
638 644
639 } // namespace task_manager 645 } // namespace task_manager
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698