blob: a01e15e1ae1f662822cbe482eb3f5fe6d506849b (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// Copyright 2012 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 CCTextureUpdateController_h
#define CCTextureUpdateController_h
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
#include "cc/texture_update_queue.h"
#include "cc/timer.h"
namespace cc {
class TextureUploader;
class CCTextureUpdateControllerClient {
public:
virtual void readyToFinalizeTextureUpdates() = 0;
protected:
virtual ~CCTextureUpdateControllerClient() { }
};
class CCTextureUpdateController : public CCTimerClient {
public:
static scoped_ptr<CCTextureUpdateController> create(CCTextureUpdateControllerClient* client, CCThread* thread, scoped_ptr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureUploader* uploader)
{
return make_scoped_ptr(new CCTextureUpdateController(client, thread, queue.Pass(), resourceProvider, uploader));
}
static size_t maxPartialTextureUpdates();
virtual ~CCTextureUpdateController();
// Discard uploads to textures that were evicted on the impl thread.
void discardUploadsToEvictedResources();
void performMoreUpdates(base::TimeTicks timeLimit);
void finalize();
// CCTimerClient implementation.
virtual void onTimerFired() OVERRIDE;
// Virtual for testing.
virtual base::TimeTicks now() const;
virtual base::TimeDelta updateMoreTexturesTime() const;
virtual size_t updateMoreTexturesSize() const;
protected:
CCTextureUpdateController(CCTextureUpdateControllerClient*, CCThread*, scoped_ptr<CCTextureUpdateQueue>, CCResourceProvider*, TextureUploader*);
static size_t maxFullUpdatesPerTick(TextureUploader*);
size_t maxBlockingUpdates() const;
// This returns true when there were textures left to update.
bool updateMoreTexturesIfEnoughTimeRemaining();
void updateMoreTexturesNow();
CCTextureUpdateControllerClient* m_client;
scoped_ptr<CCTimer> m_timer;
scoped_ptr<CCTextureUpdateQueue> m_queue;
bool m_contentsTexturesPurged;
CCResourceProvider* m_resourceProvider;
TextureUploader* m_uploader;
base::TimeTicks m_timeLimit;
size_t m_textureUpdatesPerTick;
bool m_firstUpdateAttempt;
private:
DISALLOW_COPY_AND_ASSIGN(CCTextureUpdateController);
};
} // namespace cc
#endif // CCTextureUpdateController_h
|