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

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/ImageResource.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
« no previous file with comments | « AUTHORS ('k') | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 GetContent()->NotifyStartLoad(); 367 GetContent()->NotifyStartLoad();
368 } 368 }
369 369
370 void ImageResource::Finish(double load_finish_time) { 370 void ImageResource::Finish(double load_finish_time) {
371 if (multipart_parser_) { 371 if (multipart_parser_) {
372 multipart_parser_->Finish(); 372 multipart_parser_->Finish();
373 if (Data()) 373 if (Data())
374 UpdateImageAndClearBuffer(); 374 UpdateImageAndClearBuffer();
375 } else { 375 } else {
376 UpdateImage(Data(), ImageResourceContent::kUpdateImage, true); 376 UpdateImage(Data(), ImageResourceContent::kUpdateImage, true);
377 // As encoded image data can be created from m_image (see
378 // ImageResource::resourceBuffer(), we don't have to keep m_data. Let's
379 // clear this. As for the lifetimes of m_image and m_data, see this
380 // document:
381 // https://docs.google.com/document/d/1v0yTAZ6wkqX2U_M6BNIGUJpM1s0TIw1Vsqpxo L7aciY/edit?usp=sharing
382 ClearData();
383 } 377 }
384 Resource::Finish(load_finish_time); 378 Resource::Finish(load_finish_time);
385 } 379 }
386 380
387 void ImageResource::FinishAsError(const ResourceError& error) { 381 void ImageResource::FinishAsError(const ResourceError& error) {
388 if (multipart_parser_) 382 if (multipart_parser_)
389 multipart_parser_->Cancel(); 383 multipart_parser_->Cancel();
390 // TODO(hiroshige): Move setEncodedSize() call to Resource::error() if it 384 // TODO(hiroshige): Move setEncodedSize() call to Resource::error() if it
391 // is really needed, or remove it otherwise. 385 // is really needed, or remove it otherwise.
392 SetEncodedSize(0); 386 SetEncodedSize(0);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 // reloading in Step 3 due to notifyObservers()'s 620 // reloading in Step 3 due to notifyObservers()'s
627 // schedulingReloadOrShouldReloadBrokenPlaceholder() check. 621 // schedulingReloadOrShouldReloadBrokenPlaceholder() check.
628 // 3. reloadIfLoFiOrPlaceholderImage() is called via ResourceFetcher 622 // 3. reloadIfLoFiOrPlaceholderImage() is called via ResourceFetcher
629 // (a) via didFinishLoading() called in decodeError(), or 623 // (a) via didFinishLoading() called in decodeError(), or
630 // (b) after returning ImageResource::updateImage(). 624 // (b) after returning ImageResource::updateImage().
631 DecodeError(all_data_received); 625 DecodeError(all_data_received);
632 } 626 }
633 } 627 }
634 628
635 } // namespace blink 629 } // namespace blink
OLDNEW
« no previous file with comments | « AUTHORS ('k') | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698