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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageSource.cpp

Issue 2918443003: Remove redundant reading and writing of data about SharedBuffer.
Patch Set: benchmark Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> 3 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk>
4 * Copyright (C) 2008, Google Inc. All rights reserved. 4 * Copyright (C) 2008, Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 24 matching lines...) Expand all
35 namespace blink { 35 namespace blink {
36 36
37 ImageSource::ImageSource() {} 37 ImageSource::ImageSource() {}
38 38
39 ImageSource::~ImageSource() {} 39 ImageSource::~ImageSource() {}
40 40
41 size_t ImageSource::ClearCacheExceptFrame(size_t clear_except_frame) { 41 size_t ImageSource::ClearCacheExceptFrame(size_t clear_except_frame) {
42 return decoder_ ? decoder_->ClearCacheExceptFrame(clear_except_frame) : 0; 42 return decoder_ ? decoder_->ClearCacheExceptFrame(clear_except_frame) : 0;
43 } 43 }
44 44
45 PassRefPtr<SharedBuffer> ImageSource::Data() {
46 return decoder_ ? decoder_->Data() : nullptr;
47 }
48
49 bool ImageSource::SetData(RefPtr<SharedBuffer> data, bool all_data_received) { 45 bool ImageSource::SetData(RefPtr<SharedBuffer> data, bool all_data_received) {
50 all_data_received_ = all_data_received; 46 all_data_received_ = all_data_received;
51 47
52 if (decoder_) { 48 if (decoder_) {
53 decoder_->SetData(std::move(data), all_data_received); 49 decoder_->SetData(std::move(data), all_data_received);
54 // If the decoder is pre-instantiated, it means we've already validated the 50 // If the decoder is pre-instantiated, it means we've already validated the
55 // data/signature at some point. 51 // data/signature at some point.
56 return true; 52 return true;
57 } 53 }
58 54
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 139
144 bool ImageSource::FrameIsCompleteAtIndex(size_t index) const { 140 bool ImageSource::FrameIsCompleteAtIndex(size_t index) const {
145 return decoder_ && decoder_->FrameIsCompleteAtIndex(index); 141 return decoder_ && decoder_->FrameIsCompleteAtIndex(index);
146 } 142 }
147 143
148 size_t ImageSource::FrameBytesAtIndex(size_t index) const { 144 size_t ImageSource::FrameBytesAtIndex(size_t index) const {
149 return decoder_ ? decoder_->FrameBytesAtIndex(index) : 0; 145 return decoder_ ? decoder_->FrameBytesAtIndex(index) : 0;
150 } 146 }
151 147
152 } // namespace blink 148 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698