Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/engine/main.cpp

Issue 11013110: Cleanup (Closed)
Patch Set: More refactoring. Removing main thread, tab counting. Implementing SetPref and GetPref. Addressing … Created July 9, 2013, 12:59 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/engine/main.cpp
===================================================================
--- a/src/engine/main.cpp
+++ b/src/engine/main.cpp
@@ -143,6 +143,31 @@
filterEngine->GetFilter(text)->RemoveFromList();
break;
}
+ case Communication::PROC_SET_PREF:
+ {
+ std::string prefName = "";
+ std::string prefValue = "";
Wladimir Palant 2013/07/11 12:53:10 Please don't initialize these variables, their ini
+ request >> prefName;
+ request >> prefValue;
Wladimir Palant 2013/07/11 12:53:10 These lines can be merged: request >> prefName >>
+ filterEngine->SetPref(prefName, filterEngine->GetJsEngine()->NewValue(prefValue));
Wladimir Palant 2013/07/11 12:53:10 What about preferences with non-string values? Thi
+ break;
+ }
+ case Communication::PROC_GET_PREF:
+ {
+ std::string name;
+ request >> name;
+
+ AdblockPlus::JsValuePtr valuePtr = filterEngine->GetPref(name);
+ if ((valuePtr->IsNull()) || (!valuePtr->IsString()))
Wladimir Palant 2013/07/11 12:53:10 I think checking valuePtr->IsString() is sufficien
+ response << 0;
Wladimir Palant 2013/07/11 12:53:10 Please don't use an integer as a boolean, this sho
+ else
+ {
+ response << 1;
+ response << valuePtr->AsString();
Wladimir Palant 2013/07/11 12:53:10 These two lines can be merged: response << true
+ }
+ break;
+ }
+
}
return response;
}

Powered by Google App Engine
This is Rietveld