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 "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 Loading... |
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 Loading... |
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 |
OLD | NEW |