| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 EXPECT_EQ(1, image->height()); | 210 EXPECT_EQ(1, image->height()); |
| 211 | 211 |
| 212 PaintRecorder recorder; | 212 PaintRecorder recorder; |
| 213 PaintCanvas* temp_canvas = recorder.beginRecording(100, 100); | 213 PaintCanvas* temp_canvas = recorder.beginRecording(100, 100); |
| 214 temp_canvas->drawImage(PaintImage(std::move(image)), 0, 0); | 214 temp_canvas->drawImage(PaintImage(std::move(image)), 0, 0); |
| 215 sk_sp<PaintRecord> record = recorder.finishRecordingAsPicture(); | 215 sk_sp<PaintRecord> record = recorder.finishRecordingAsPicture(); |
| 216 EXPECT_EQ(0, decode_request_count_); | 216 EXPECT_EQ(0, decode_request_count_); |
| 217 | 217 |
| 218 // Create a thread to rasterize PaintRecord. | 218 // Create a thread to rasterize PaintRecord. |
| 219 std::unique_ptr<WebThread> thread = | 219 std::unique_ptr<WebThread> thread = |
| 220 Platform::Current()->CreateThread("RasterThread"); | 220 WTF::WrapUnique(Platform::Current()->CreateThread("RasterThread")); |
| 221 thread->GetWebTaskRunner()->PostTask( | 221 thread->GetWebTaskRunner()->PostTask( |
| 222 BLINK_FROM_HERE, | 222 BLINK_FROM_HERE, |
| 223 CrossThreadBind(&RasterizeMain, CrossThreadUnretained(canvas_.get()), | 223 CrossThreadBind(&RasterizeMain, CrossThreadUnretained(canvas_.get()), |
| 224 record)); | 224 record)); |
| 225 thread.reset(); | 225 thread.reset(); |
| 226 EXPECT_EQ(0, decode_request_count_); | 226 EXPECT_EQ(0, decode_request_count_); |
| 227 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), bitmap_.getColor(0, 0)); | 227 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), bitmap_.getColor(0, 0)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 TEST_F(DeferredImageDecoderTest, singleFrameImageLoading) { | 230 TEST_F(DeferredImageDecoderTest, singleFrameImageLoading) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 SharedBuffer::Create(data_->Data(), data_->size()); | 383 SharedBuffer::Create(data_->Data(), data_->size()); |
| 384 EXPECT_EQ(original_data->size(), data_->size()); | 384 EXPECT_EQ(original_data->size(), data_->size()); |
| 385 lazy_decoder_->SetData(original_data, false); | 385 lazy_decoder_->SetData(original_data, false); |
| 386 RefPtr<SharedBuffer> new_data = lazy_decoder_->Data(); | 386 RefPtr<SharedBuffer> new_data = lazy_decoder_->Data(); |
| 387 EXPECT_EQ(original_data->size(), new_data->size()); | 387 EXPECT_EQ(original_data->size(), new_data->size()); |
| 388 EXPECT_EQ(0, std::memcmp(original_data->Data(), new_data->Data(), | 388 EXPECT_EQ(0, std::memcmp(original_data->Data(), new_data->Data(), |
| 389 new_data->size())); | 389 new_data->size())); |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace blink | 392 } // namespace blink |
| OLD | NEW |