Chromium Code Reviews| 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 "ui/gfx/image/image.h" | 5 #include "ui/gfx/image/image.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 736 | 736 |
| 737 internal::ImageRep* Image::GetRepresentation( | 737 internal::ImageRep* Image::GetRepresentation( |
| 738 RepresentationType rep_type, bool must_exist) const { | 738 RepresentationType rep_type, bool must_exist) const { |
| 739 CHECK(storage_.get()); | 739 CHECK(storage_.get()); |
| 740 RepresentationMap::const_iterator it = | 740 RepresentationMap::const_iterator it = |
| 741 storage_->representations().find(rep_type); | 741 storage_->representations().find(rep_type); |
| 742 if (it == storage_->representations().end()) { | 742 if (it == storage_->representations().end()) { |
| 743 CHECK(!must_exist); | 743 CHECK(!must_exist); |
| 744 return NULL; | 744 return NULL; |
| 745 } | 745 } |
| 746 return it->second; | 746 return it->second.get(); |
| 747 } | 747 } |
| 748 | 748 |
| 749 void Image::AddRepresentation(scoped_ptr<internal::ImageRep> rep) const { | 749 void Image::AddRepresentation(scoped_ptr<internal::ImageRep> rep) const { |
| 750 CHECK(storage_.get()); | 750 CHECK(storage_.get()); |
| 751 RepresentationType type = rep->type(); | 751 RepresentationType type = rep->type(); |
| 752 storage_->representations().insert(type, rep.Pass()); | 752 storage_->representations()[type] = std::move(rep); |
|
danakj
2015/11/18 23:03:56
why'd you change it to [] instead to insert? it's
limasdf
2015/11/18 23:12:07
Hm..No big reason, going back to 'insert()'.
| |
| 753 } | 753 } |
| 754 | 754 |
| 755 } // namespace gfx | 755 } // namespace gfx |
| OLD | NEW |