Revert of xp: copy dbghelp.dll to output dir and have base.isolate use it there ...
[chromium-blink-merge.git] / cc / test / fake_ui_resource_layer_tree_host_impl.cc
blobc95ad89cc8fc5ea2fba1aff0667b7bd163316001
1 // Copyright 2013 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.
5 #include "cc/test/fake_ui_resource_layer_tree_host_impl.h"
7 #include "cc/test/fake_layer_tree_host_impl.h"
9 namespace cc {
11 FakeUIResourceLayerTreeHostImpl::FakeUIResourceLayerTreeHostImpl(
12 Proxy* proxy,
13 SharedBitmapManager* manager)
14 : FakeLayerTreeHostImpl(proxy, manager), fake_next_resource_id_(1) {}
16 FakeUIResourceLayerTreeHostImpl::~FakeUIResourceLayerTreeHostImpl() {}
18 void FakeUIResourceLayerTreeHostImpl::CreateUIResource(
19 UIResourceId uid,
20 const UIResourceBitmap& bitmap) {
21 if (ResourceIdForUIResource(uid))
22 DeleteUIResource(uid);
24 UIResourceData data;
25 data.resource_id = fake_next_resource_id_++;
26 data.size = bitmap.GetSize();
27 data.opaque = bitmap.GetOpaque();
28 fake_ui_resource_map_[uid] = data;
31 void FakeUIResourceLayerTreeHostImpl::DeleteUIResource(UIResourceId uid) {
32 ResourceProvider::ResourceId id = ResourceIdForUIResource(uid);
33 if (id)
34 fake_ui_resource_map_.erase(uid);
37 ResourceProvider::ResourceId
38 FakeUIResourceLayerTreeHostImpl::ResourceIdForUIResource(
39 UIResourceId uid) const {
40 UIResourceMap::const_iterator iter = fake_ui_resource_map_.find(uid);
41 if (iter != fake_ui_resource_map_.end())
42 return iter->second.resource_id;
43 return 0;
46 bool FakeUIResourceLayerTreeHostImpl::IsUIResourceOpaque(UIResourceId uid)
47 const {
48 UIResourceMap::const_iterator iter = fake_ui_resource_map_.find(uid);
49 DCHECK(iter != fake_ui_resource_map_.end());
50 return iter->second.opaque;
53 } // namespace cc