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

Side by Side Diff: content/browser/android/ui_resource_provider_impl.cc

Issue 755643004: Replace SystemUIResourceManager with ResourceManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix clang build failure Created 6 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/android/ui_resource_provider_impl.h"
6
7 #include "cc/resources/ui_resource_client.h"
8 #include "cc/trees/layer_tree_host.h"
9 #include "content/public/browser/android/ui_resource_client_android.h"
10
11 namespace content {
12
13 UIResourceProviderImpl::UIResourceProviderImpl()
14 : system_ui_resource_manager_(this), host_(NULL),
15 supports_etc1_npot_(false) {
16
17 }
18
19 UIResourceProviderImpl::~UIResourceProviderImpl() {
20 SetLayerTreeHost(NULL);
21 }
22
23 void UIResourceProviderImpl::SetLayerTreeHost(cc::LayerTreeHost* host) {
24 if (host_ == host)
25 return;
26 host_ = host;
27 UIResourcesAreInvalid();
28 }
29
30 void UIResourceProviderImpl::UIResourcesAreInvalid() {
31 UIResourceClientMap client_map = ui_resource_client_map_;
32 ui_resource_client_map_.clear();
33 for (UIResourceClientMap::iterator iter = client_map.begin();
34 iter != client_map.end();
35 iter++) {
36 iter->second->UIResourceIsInvalid();
37 }
38 }
39
40 cc::UIResourceId UIResourceProviderImpl::CreateUIResource(
41 UIResourceClientAndroid* client) {
42 if (!host_)
43 return 0;
44 cc::UIResourceId id = host_->CreateUIResource(client);
45 DCHECK(ui_resource_client_map_.find(id) == ui_resource_client_map_.end());
46
47 ui_resource_client_map_[id] = client;
48 return id;
49 }
50
51 void UIResourceProviderImpl::DeleteUIResource(cc::UIResourceId ui_resource_id) {
52 UIResourceClientMap::iterator iter =
53 ui_resource_client_map_.find(ui_resource_id);
54 DCHECK(iter != ui_resource_client_map_.end());
55
56 ui_resource_client_map_.erase(iter);
57
58 if (!host_)
59 return;
60 host_->DeleteUIResource(ui_resource_id);
61 }
62
63 ui::SystemUIResourceManager&
64 UIResourceProviderImpl::GetSystemUIResourceManager() {
65 return system_ui_resource_manager_;
66 }
67
68 bool UIResourceProviderImpl::SupportsETC1NonPowerOfTwo() const {
69 return supports_etc1_npot_;
70 }
71
72 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/ui_resource_provider_impl.h ('k') | content/browser/renderer_host/compositor_impl_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698