blob: bb56e57876d17cc80042337063344cd1bcb11f42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_
#define CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_
#include "base/synchronization/lock.h"
#include "cc/output/context_provider.h"
#include "cc/test/test_gpu_memory_buffer_manager.h"
#include "cc/test/test_image_factory.h"
#include "skia/ext/refptr.h"
class GrContext;
namespace gpu {
class GLInProcessContext;
}
namespace cc {
scoped_ptr<gpu::GLInProcessContext> CreateTestInProcessContext();
scoped_ptr<gpu::GLInProcessContext> CreateTestInProcessContext(
TestGpuMemoryBufferManager* gpu_memory_buffer_manager,
TestImageFactory* image_factory);
class TestInProcessContextProvider : public ContextProvider {
public:
TestInProcessContextProvider();
bool BindToCurrentThread() override;
gpu::gles2::GLES2Interface* ContextGL() override;
gpu::ContextSupport* ContextSupport() override;
class GrContext* GrContext() override;
void InvalidateGrContext(uint32_t state) override;
void SetupLock() override;
base::Lock* GetLock() override;
Capabilities ContextCapabilities() override;
bool IsContextLost() override;
void VerifyContexts() override;
void DeleteCachedResources() override;
bool DestroyedOnMainThread() override;
void SetLostContextCallback(
const LostContextCallback& lost_context_callback) override;
void SetMemoryPolicyChangedCallback(
const MemoryPolicyChangedCallback& memory_policy_changed_callback)
override;
protected:
friend class base::RefCountedThreadSafe<TestInProcessContextProvider>;
~TestInProcessContextProvider() override;
private:
TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
TestImageFactory image_factory_;
scoped_ptr<gpu::GLInProcessContext> context_;
skia::RefPtr<class GrContext> gr_context_;
base::Lock context_lock_;
};
} // namespace cc
#endif // CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_
|