blob: 6ca2813fc6ae0738bbf47894ffa0fd37703cd151 (
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
|
#pragma once
#include "drape_frontend/memory_feature_index.hpp"
#include "drape_frontend/engine_context.hpp"
#include "drape_frontend/tile_info.hpp"
#include "drape_frontend/read_mwm_task.hpp"
#include "geometry/screenbase.hpp"
#include "drape/pointers.hpp"
#include "drape/object_pool.hpp"
#include "base/thread_pool.hpp"
#include "std/set.hpp"
#include "std/shared_ptr.hpp"
namespace df
{
class MapDataProvider;
class CoverageUpdateDescriptor;
typedef shared_ptr<TileInfo> tileinfo_ptr;
class ReadManager
{
public:
ReadManager(EngineContext & context, MapDataProvider & model);
void UpdateCoverage(ScreenBase const & screen, set<TileKey> const & tiles);
void Invalidate(set<TileKey> const & keyStorage);
void Stop();
static size_t ReadCount();
private:
void OnTaskFinished(threads::IRoutine * task);
bool MustDropAllTiles(ScreenBase const & screen) const;
void PushTaskBackForTileKey(TileKey const & tileKey);
void PushTaskFront(tileinfo_ptr const & tileToReread);
private:
MemoryFeatureIndex m_memIndex;
EngineContext & m_context;
MapDataProvider & m_model;
dp::MasterPointer<threads::ThreadPool> m_pool;
ScreenBase m_currentViewport;
struct LessByTileKey
{
bool operator ()(tileinfo_ptr const & l, tileinfo_ptr const & r) const
{
return *l < *r;
}
};
typedef set<tileinfo_ptr, LessByTileKey> tile_set_t;
tile_set_t m_tileInfos;
ObjectPool<ReadMWMTask, ReadMWMTaskFactory> myPool;
void CancelTileInfo(tileinfo_ptr const & tileToCancel);
void ClearTileInfo(tileinfo_ptr const & tileToClear);
};
} // namespace df
|