Merge lp:~unity-team/unity/unity.results-cache into lp:unity

Proposed by Tim Penhey
Status: Work in progress
Proposed branch: lp:~unity-team/unity/unity.results-cache
Merge into: lp:unity
Diff against target: 105 lines (+76/-8)
2 files modified
UnityCore/Result.cpp (+60/-8)
UnityCore/Result.h (+16/-0)
To merge this branch: bzr merge lp:~unity-team/unity/unity.results-cache
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+75665@code.launchpad.net
To post a comment you must log in.
1572. By Jason Smith

slight correctness, still crashes

Unmerged revisions

1572. By Jason Smith

slight correctness, still crashes

1571. By Jason Smith

cache results from libdee rather than reload them constantly at a big performance penalty

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UnityCore/Result.cpp'
2--- UnityCore/Result.cpp 2011-09-13 22:35:13 +0000
3+++ UnityCore/Result.cpp 2011-09-16 03:28:24 +0000
4@@ -48,14 +48,66 @@
5
6 void Result::SetupGetters()
7 {
8- uri.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 0));
9- icon_hint.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 1));
10- category_index.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetUIntAt), 2));
11- mimetype.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 3));
12- name.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 4));
13- comment.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 5));
14- dnd_uri.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 6));
15-}
16+ _category_index = 9999;
17+
18+ uri .SetGetterFunction(sigc::mem_fun(this, &Result::GetUri));
19+ icon_hint .SetGetterFunction(sigc::mem_fun(this, &Result::GetIconHint));
20+ category_index.SetGetterFunction(sigc::mem_fun(this, &Result::GetCategoryIndex));
21+ mimetype .SetGetterFunction(sigc::mem_fun(this, &Result::GetMimetype));
22+ name .SetGetterFunction(sigc::mem_fun(this, &Result::GetName));
23+ comment .SetGetterFunction(sigc::mem_fun(this, &Result::GetComment));
24+ dnd_uri .SetGetterFunction(sigc::mem_fun(this, &Result::GetDndUri));
25+}
26+
27+std::string Result::GetUri()
28+{
29+ if (_uri.empty())
30+ _uri = RowAdaptorBase::GetStringAt(0);
31+ return _uri;
32+}
33+
34+std::string Result::GetIconHint()
35+{
36+ if (_icon_hint.empty())
37+ _icon_hint = RowAdaptorBase::GetStringAt(1);
38+ return _icon_hint;
39+}
40+
41+std::size_t Result::GetCategoryIndex()
42+{
43+ if (_category_index == 9999)
44+ _category_index = RowAdaptorBase::GetUIntAt(2);
45+ return _category_index;
46+}
47+
48+std::string Result::GetMimetype()
49+{
50+ if (_mimetype.empty())
51+ _mimetype = RowAdaptorBase::GetStringAt(3);
52+ return _mimetype;
53+}
54+
55+std::string Result::GetName()
56+{
57+ if (_name.empty())
58+ _name = RowAdaptorBase::GetStringAt(4);
59+ return _name;
60+}
61+
62+std::string Result::GetComment()
63+{
64+ if (_comment.empty())
65+ _comment = RowAdaptorBase::GetStringAt(5);
66+ return _comment;
67+}
68+
69+std::string Result::GetDndUri()
70+{
71+ if (_dnd_uri.empty())
72+ _dnd_uri = RowAdaptorBase::GetStringAt(6);
73+ return _dnd_uri;
74+}
75+
76
77 }
78 }
79
80=== modified file 'UnityCore/Result.h'
81--- UnityCore/Result.h 2011-09-13 22:35:13 +0000
82+++ UnityCore/Result.h 2011-09-16 03:28:24 +0000
83@@ -53,6 +53,22 @@
84
85 private:
86 void SetupGetters();
87+
88+ std::string GetUri();
89+ std::string GetIconHint();
90+ std::size_t GetCategoryIndex();
91+ std::string GetMimetype();
92+ std::string GetName();
93+ std::string GetComment();
94+ std::string GetDndUri();
95+
96+ std::string _uri;
97+ std::string _icon_hint;
98+ std::size_t _category_index;
99+ std::string _mimetype;
100+ std::string _name;
101+ std::string _comment;
102+ std::string _dnd_uri;
103 };
104
105 }