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

Side by Side Diff: content/shell/renderer/webkit_test_runner.cc

Issue 583703002: Annotate CaptureDumpPixels for MemorySanitizer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 (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 "content/shell/renderer/webkit_test_runner.h" 5 #include "content/shell/renderer/webkit_test_runner.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <clocale> 8 #include <clocale>
9 #include <cmath> 9 #include <cmath>
10 10
11 #include "base/base64.h" 11 #include "base/base64.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/compiler_specific.h"
13 #include "base/debug/debugger.h" 14 #include "base/debug/debugger.h"
14 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
15 #include "base/md5.h" 16 #include "base/md5.h"
16 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
17 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
20 #include "base/strings/sys_string_conversions.h" 21 #include "base/strings/sys_string_conversions.h"
21 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
22 #include "base/time/time.h" 23 #include "base/time/time.h"
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } 660 }
660 661
661 CaptureDumpComplete(); 662 CaptureDumpComplete();
662 } 663 }
663 664
664 void WebKitTestRunner::CaptureDumpPixels(const SkBitmap& snapshot) { 665 void WebKitTestRunner::CaptureDumpPixels(const SkBitmap& snapshot) {
665 DCHECK_NE(0, snapshot.info().fWidth); 666 DCHECK_NE(0, snapshot.info().fWidth);
666 DCHECK_NE(0, snapshot.info().fHeight); 667 DCHECK_NE(0, snapshot.info().fHeight);
667 668
668 SkAutoLockPixels snapshot_lock(snapshot); 669 SkAutoLockPixels snapshot_lock(snapshot);
670 // The snapshot arrives from the GPU process via shared memory. Because MSan
671 // can't track initializedness across processes, we must assure it that the
672 // pixels are in fact initialized.
673 MSAN_UNPOISON(snapshot.getPixels(), snapshot.getSize());
669 base::MD5Digest digest; 674 base::MD5Digest digest;
670 base::MD5Sum(snapshot.getPixels(), snapshot.getSize(), &digest); 675 base::MD5Sum(snapshot.getPixels(), snapshot.getSize(), &digest);
671 std::string actual_pixel_hash = base::MD5DigestToBase16(digest); 676 std::string actual_pixel_hash = base::MD5DigestToBase16(digest);
672 677
673 if (actual_pixel_hash == test_config_.expected_pixel_hash) { 678 if (actual_pixel_hash == test_config_.expected_pixel_hash) {
674 SkBitmap empty_image; 679 SkBitmap empty_image;
675 Send(new ShellViewHostMsg_ImageDump( 680 Send(new ShellViewHostMsg_ImageDump(
676 routing_id(), actual_pixel_hash, empty_image)); 681 routing_id(), actual_pixel_hash, empty_image));
677 } else { 682 } else {
678 Send(new ShellViewHostMsg_ImageDump( 683 Send(new ShellViewHostMsg_ImageDump(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 747
743 leak_detector_->TryLeakDetection(main_frame); 748 leak_detector_->TryLeakDetection(main_frame);
744 } 749 }
745 750
746 void WebKitTestRunner::ReportLeakDetectionResult( 751 void WebKitTestRunner::ReportLeakDetectionResult(
747 const LeakDetectionResult& report) { 752 const LeakDetectionResult& report) {
748 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 753 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
749 } 754 }
750 755
751 } // namespace content 756 } // namespace content
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