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
=== modified file 'UnityCore/Result.cpp'
--- UnityCore/Result.cpp 2011-09-13 22:35:13 +0000
+++ UnityCore/Result.cpp 2011-09-16 03:28:24 +0000
@@ -48,14 +48,66 @@
4848
49void Result::SetupGetters()49void Result::SetupGetters()
50{50{
51 uri.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 0));51 _category_index = 9999;
52 icon_hint.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 1));52
53 category_index.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetUIntAt), 2));53 uri .SetGetterFunction(sigc::mem_fun(this, &Result::GetUri));
54 mimetype.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 3));54 icon_hint .SetGetterFunction(sigc::mem_fun(this, &Result::GetIconHint));
55 name.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 4));55 category_index.SetGetterFunction(sigc::mem_fun(this, &Result::GetCategoryIndex));
56 comment.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 5));56 mimetype .SetGetterFunction(sigc::mem_fun(this, &Result::GetMimetype));
57 dnd_uri.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 6));57 name .SetGetterFunction(sigc::mem_fun(this, &Result::GetName));
58}58 comment .SetGetterFunction(sigc::mem_fun(this, &Result::GetComment));
59 dnd_uri .SetGetterFunction(sigc::mem_fun(this, &Result::GetDndUri));
60}
61
62std::string Result::GetUri()
63{
64 if (_uri.empty())
65 _uri = RowAdaptorBase::GetStringAt(0);
66 return _uri;
67}
68
69std::string Result::GetIconHint()
70{
71 if (_icon_hint.empty())
72 _icon_hint = RowAdaptorBase::GetStringAt(1);
73 return _icon_hint;
74}
75
76std::size_t Result::GetCategoryIndex()
77{
78 if (_category_index == 9999)
79 _category_index = RowAdaptorBase::GetUIntAt(2);
80 return _category_index;
81}
82
83std::string Result::GetMimetype()
84{
85 if (_mimetype.empty())
86 _mimetype = RowAdaptorBase::GetStringAt(3);
87 return _mimetype;
88}
89
90std::string Result::GetName()
91{
92 if (_name.empty())
93 _name = RowAdaptorBase::GetStringAt(4);
94 return _name;
95}
96
97std::string Result::GetComment()
98{
99 if (_comment.empty())
100 _comment = RowAdaptorBase::GetStringAt(5);
101 return _comment;
102}
103
104std::string Result::GetDndUri()
105{
106 if (_dnd_uri.empty())
107 _dnd_uri = RowAdaptorBase::GetStringAt(6);
108 return _dnd_uri;
109}
110
59111
60}112}
61}113}
62114
=== modified file 'UnityCore/Result.h'
--- UnityCore/Result.h 2011-09-13 22:35:13 +0000
+++ UnityCore/Result.h 2011-09-16 03:28:24 +0000
@@ -53,6 +53,22 @@
5353
54private:54private:
55 void SetupGetters();55 void SetupGetters();
56
57 std::string GetUri();
58 std::string GetIconHint();
59 std::size_t GetCategoryIndex();
60 std::string GetMimetype();
61 std::string GetName();
62 std::string GetComment();
63 std::string GetDndUri();
64
65 std::string _uri;
66 std::string _icon_hint;
67 std::size_t _category_index;
68 std::string _mimetype;
69 std::string _name;
70 std::string _comment;
71 std::string _dnd_uri;
56};72};
5773
58}74}