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 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 if (it == storage_->representations().end()) { | 745 if (it == storage_->representations().end()) { |
746 CHECK(!must_exist); | 746 CHECK(!must_exist); |
747 return NULL; | 747 return NULL; |
748 } | 748 } |
749 return it->second.get(); | 749 return it->second.get(); |
750 } | 750 } |
751 | 751 |
752 void Image::AddRepresentation(scoped_ptr<internal::ImageRep> rep) const { | 752 void Image::AddRepresentation(scoped_ptr<internal::ImageRep> rep) const { |
753 CHECK(storage_.get()); | 753 CHECK(storage_.get()); |
754 RepresentationType type = rep->type(); | 754 RepresentationType type = rep->type(); |
755 storage_->representations().insert(std::make_pair(type, std::move(rep))); | 755 auto result = |
| 756 storage_->representations().insert(std::make_pair(type, std::move(rep))); |
| 757 |
| 758 // insert should not fail (implies that there was already a representation of |
| 759 // that type in the map). |
| 760 CHECK(result.second) << "type was already in map."; |
756 } | 761 } |
757 | 762 |
758 } // namespace gfx | 763 } // namespace gfx |
OLD | NEW |