| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/android/system_ui_resource_manager_impl.h" | 5 #include "content/browser/android/system_ui_resource_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 cc::UIResourceId GetUIResourceId() { | 97 cc::UIResourceId GetUIResourceId() { |
| 98 if (bitmap_.empty()) | 98 if (bitmap_.empty()) |
| 99 return 0; | 99 return 0; |
| 100 if (!id_) | 100 if (!id_) |
| 101 id_ = provider_->CreateUIResource(this); | 101 id_ = provider_->CreateUIResource(this); |
| 102 return id_; | 102 return id_; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // content::UIResourceClient implementation. | 105 // content::UIResourceClient implementation. |
| 106 virtual cc::UIResourceBitmap GetBitmap(cc::UIResourceId uid, | 106 virtual cc::UIResourceBitmap GetBitmap(cc::UIResourceId uid, |
| 107 bool resource_lost) OVERRIDE { | 107 bool resource_lost) override { |
| 108 DCHECK(!bitmap_.empty()); | 108 DCHECK(!bitmap_.empty()); |
| 109 return cc::UIResourceBitmap(bitmap_); | 109 return cc::UIResourceBitmap(bitmap_); |
| 110 } | 110 } |
| 111 | 111 |
| 112 // content::UIResourceClientAndroid implementation. | 112 // content::UIResourceClientAndroid implementation. |
| 113 virtual void UIResourceIsInvalid() OVERRIDE { id_ = 0; } | 113 virtual void UIResourceIsInvalid() override { id_ = 0; } |
| 114 | 114 |
| 115 const SkBitmap& bitmap() const { return bitmap_; } | 115 const SkBitmap& bitmap() const { return bitmap_; } |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 SkBitmap bitmap_; | 118 SkBitmap bitmap_; |
| 119 cc::UIResourceId id_; | 119 cc::UIResourceId id_; |
| 120 UIResourceProvider* provider_; | 120 UIResourceProvider* provider_; |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(Entry); | 122 DISALLOW_COPY_AND_ASSIGN(Entry); |
| 123 }; | 123 }; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 void SystemUIResourceManagerImpl::OnFinishedLoadBitmap( | 172 void SystemUIResourceManagerImpl::OnFinishedLoadBitmap( |
| 173 ResourceType type, | 173 ResourceType type, |
| 174 SkBitmap* bitmap_holder) { | 174 SkBitmap* bitmap_holder) { |
| 175 DCHECK(bitmap_holder); | 175 DCHECK(bitmap_holder); |
| 176 GetEntry(type)->SetBitmap(*bitmap_holder); | 176 GetEntry(type)->SetBitmap(*bitmap_holder); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace content | 179 } // namespace content |
| OLD | NEW |