1 // Copyright 2012 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 #ifndef CC_RESOURCES_SCOPED_RESOURCE_H_
6 #define CC_RESOURCES_SCOPED_RESOURCE_H_
8 #include "base/basictypes.h"
9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/resources/resource.h"
15 #include "base/threading/platform_thread.h"
20 class CC_EXPORT ScopedResource
: public Resource
{
22 static scoped_ptr
<ScopedResource
> Create(
23 ResourceProvider
* resource_provider
) {
24 return make_scoped_ptr(new ScopedResource(resource_provider
));
26 virtual ~ScopedResource();
28 void Allocate(const gfx::Size
& size
,
29 ResourceProvider::TextureHint hint
,
30 ResourceFormat format
);
31 void AllocateManaged(const gfx::Size
& size
,
33 ResourceFormat format
);
37 explicit ScopedResource(ResourceProvider
* provider
);
40 ResourceProvider
* resource_provider_
;
43 base::PlatformThreadId allocate_thread_id_
;
46 DISALLOW_COPY_AND_ASSIGN(ScopedResource
);
51 #endif // CC_RESOURCES_SCOPED_RESOURCE_H_