summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Kozoriz <AKozoriz@luxoft.com>2016-02-12 18:00:25 +0200
committerKozoriz <kozorizandriy@gmail.com>2016-02-17 10:16:16 +0200
commit0bc55c8bf92fca0d4d65304b6733397b07d4a197 (patch)
tree4f7dfedc1eb88b9e9f2b75bcab86672795885632
parenteb541f40016562236af78c6bb611bdc766b00c1d (diff)
downloadsmartdevicelink-0bc55c8bf92fca0d4d65304b6733397b07d4a197.tar.gz
Small correctives.
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h2
-rw-r--r--src/components/application_manager/src/application_impl.cc6
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc4
-rw-r--r--src/components/policy/src/policy/src/policy_manager_impl.cc1
-rw-r--r--src/components/utils/include/utils/timer.h13
-rw-r--r--src/components/utils/src/timer.cc7
-rw-r--r--src/components/utils/test/timer_test.cc26
7 files changed, 31 insertions, 28 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index 67bb3adc5..cd3ff0046 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -1471,8 +1471,6 @@ typedef utils::SharedPtr<timer::Timer> TimerSPtr;
AMMetricObserver* metric_observer_;
#endif // TIME_TESTER
- typedef utils::SharedPtr<ApplicationListUpdateTimer>
- ApplicationListUpdateTimerSptr;
Timer application_list_update_timer_;
Timer tts_global_properties_timer_;
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 86c864e86..acdb35224 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -70,10 +70,8 @@ mobile_apis::FileType::eType StringToFileType(const char* str) {
}
}
-namespace application_manager {
-
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
-
+namespace application_manager {
ApplicationImpl::ApplicationImpl(
uint32_t application_id,
const std::string& mobile_app_id,
@@ -121,7 +119,7 @@ ApplicationImpl::ApplicationImpl(
cmd_number_to_time_limits_[mobile_apis::FunctionID::GetVehicleDataID] = {
date_time::DateTime::getCurrentTime(), 0};
- set_policy_app_id(policy_app_id);
+ set_mobile_app_id(mobile_app_id);
set_name(app_name);
MarkUnregistered();
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 73abcd4b6..088e69c22 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -127,12 +127,12 @@ ApplicationManagerImpl::ApplicationManagerImpl()
"AM ListUpdater",
new TimerTaskImpl<ApplicationManagerImpl>(
this,
- &ApplicationManagerImpl::OnApplicationListUpdateTimer)),
+ &ApplicationManagerImpl::OnApplicationListUpdateTimer))
, tts_global_properties_timer_(
"AM TTSGLPRTimer",
new TimerTaskImpl<ApplicationManagerImpl>(
this,
- &ApplicationManagerImpl::OnTimerSendTTSGlobalProperties)),
+ &ApplicationManagerImpl::OnTimerSendTTSGlobalProperties))
, is_low_voltage_(false)
, is_stopping_(false) {
diff --git a/src/components/policy/src/policy/src/policy_manager_impl.cc b/src/components/policy/src/policy/src/policy_manager_impl.cc
index a9c1c2936..910ec764c 100644
--- a/src/components/policy/src/policy/src/policy_manager_impl.cc
+++ b/src/components/policy/src/policy/src/policy_manager_impl.cc
@@ -35,6 +35,7 @@
#include <set>
#include <queue>
#include <iterator>
+#include <limits>
#include "json/reader.h"
#include "json/writer.h"
#include "policy/policy_table.h"
diff --git a/src/components/utils/include/utils/timer.h b/src/components/utils/include/utils/timer.h
index 90f942acd..cbce920e4 100644
--- a/src/components/utils/include/utils/timer.h
+++ b/src/components/utils/include/utils/timer.h
@@ -34,7 +34,14 @@
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_H_
#include <stdint.h>
+
+#ifdef __QNX__
+#include <sys/siginfo.h>
+#else
#include <signal.h>
+typedef sigval_t sigval;
+#endif
+
#include <time.h>
#include <string>
@@ -113,10 +120,10 @@ class Timer {
bool StopUnsafe();
/**
- * @brief alone function which sends to posix_timer as calle
- * @param signal_value - structure with parameters of posix_timer calle
+ * @brief alone function which sends to posix_timer as callee
+ * @param signal_value - structure with parameters of posix_timer callee
*/
- friend void HandlePosixTimer(sigval_t signal_value);
+ friend void HandlePosixTimer(sigval signal_value);
DISALLOW_COPY_AND_ASSIGN(Timer);
};
diff --git a/src/components/utils/src/timer.cc b/src/components/utils/src/timer.cc
index fb17bf265..57552ca49 100644
--- a/src/components/utils/src/timer.cc
+++ b/src/components/utils/src/timer.cc
@@ -49,7 +49,7 @@ namespace timer {
// Function HandlePosixTimer is not in anonymous namespace
// because we need to set this func as friend to Timer
// and for setting friend function must be located in same namespace with class
-void HandlePosixTimer(sigval_t signal_value) {
+void HandlePosixTimer(sigval signal_value) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(signal_value.sival_ptr)
@@ -127,8 +127,7 @@ timer::Timer::Timer(const std::string& name, const TimerTask* task_for_tracking)
, is_running_(false)
, timer_(NULL) {
LOG4CXX_AUTO_TRACE(logger_);
- bool is_name_empty = !name_.empty();
- DCHECK(is_name_empty);
+ DCHECK(!name_.empty());
DCHECK(task_);
}
@@ -177,7 +176,7 @@ void timer::Timer::OnTimeout() {
// Task locked by own lock because from this task in callback we can
// call Stop of this timer and get DeadLock
sync_primitives::AutoLock auto_lock(task_lock_);
- DCHECK_OR_RETURN_VOID(task_);
+ DCHECK(task_);
task_->run();
}
sync_primitives::AutoLock auto_lock(lock_);
diff --git a/src/components/utils/test/timer_test.cc b/src/components/utils/test/timer_test.cc
index dadec5393..aaec451f9 100644
--- a/src/components/utils/test/timer_test.cc
+++ b/src/components/utils/test/timer_test.cc
@@ -47,8 +47,8 @@ namespace {
sync_primitives::Lock test_lock;
sync_primitives::ConditionalVariable lock_monitor;
-const uint32_t default_timeout = 30u;
-const std::string timer_name_ = "test_timer";
+const uint32_t kDefaultTimeout = 30u;
+const std::string kTimerName = "test_timer";
class TestTask : public timer::TimerTask {
public:
@@ -73,7 +73,7 @@ class FakeClassWithTimer {
, internal_timer_("test_timer",
new timer::TimerTaskImpl<FakeClassWithTimer>(
this, &FakeClassWithTimer::OnTimer)) {
- internal_timer_.Start(default_timeout, true);
+ internal_timer_.Start(kDefaultTimeout, true);
}
void OnTimer() {
sync_primitives::AutoLock auto_lock_(test_lock);
@@ -98,7 +98,7 @@ class FakeClassWithTimer {
class TimerTest : public testing::Test {
protected:
void SetUp() OVERRIDE {
- timeout_ = default_timeout;
+ timeout_ = kDefaultTimeout;
repeatable_ = false;
// Will be destroyed in Timer Destructor
test_task_ = new MockTimerTask();
@@ -110,7 +110,7 @@ class TimerTest : public testing::Test {
TEST_F(TimerTest, Start_ZeroTimeout_CorrectTimeout) {
// Preconditions
- timer::Timer test_timer(timer_name_, test_task_);
+ timer::Timer test_timer(kTimerName, test_task_);
// Actions
test_timer.Start(0u, repeatable_);
// Expects
@@ -123,7 +123,7 @@ TEST_F(TimerTest, Start_NoLoop_OneCall) {
// Preconditions
test_lock.Acquire();
TestTask* task = new TestTask();
- timer::Timer test_timer(timer_name_, task);
+ timer::Timer test_timer(kTimerName, task);
// Actions
test_timer.Start(timeout_, repeatable_);
ASSERT_TRUE(test_timer.IsRunning());
@@ -140,7 +140,7 @@ TEST_F(TimerTest, Start_Loop_3Calls) {
repeatable_ = true;
test_lock.Acquire();
TestTask* task = new TestTask();
- timer::Timer test_timer(timer_name_, task);
+ timer::Timer test_timer(kTimerName, task);
// Actions
test_timer.Start(timeout_, repeatable_);
for (int i = loops_count; i; --i) {
@@ -154,7 +154,7 @@ TEST_F(TimerTest, Start_Loop_3Calls) {
TEST_F(TimerTest, Start_Runned_RunnedWithNewTimeout) {
// Preconditions
- timer::Timer test_timer(timer_name_, test_task_);
+ timer::Timer test_timer(kTimerName, test_task_);
// Actions
test_timer.Start(timeout_, repeatable_);
// Expects
@@ -170,7 +170,7 @@ TEST_F(TimerTest, Start_Runned_RunnedWithNewTimeout) {
TEST_F(TimerTest, Start_NotRunned_RunnedWithNewTimeout) {
// Preconditions
- timer::Timer test_timer(timer_name_, test_task_);
+ timer::Timer test_timer(kTimerName, test_task_);
// Expects
ASSERT_EQ(0u, test_timer.GetTimeout());
ASSERT_FALSE(test_timer.IsRunning());
@@ -185,7 +185,7 @@ TEST_F(TimerTest, Start_NotRunned_RunnedWithNewTimeout) {
TEST_F(TimerTest, Stop_FirstLoop_NoCall) {
// Preconditions
- timer::Timer test_timer(timer_name_, test_task_);
+ timer::Timer test_timer(kTimerName, test_task_);
// Expects
EXPECT_CALL(*test_task_, run()).Times(0);
// Actions
@@ -197,7 +197,7 @@ TEST_F(TimerTest, Stop_SecondLoop_OneCall) {
// Preconditions
test_lock.Acquire();
TestTask* task = new TestTask();
- timer::Timer test_timer(timer_name_, task);
+ timer::Timer test_timer(kTimerName, task);
// Actions
test_timer.Start(timeout_, repeatable_);
ASSERT_TRUE(test_timer.IsRunning());
@@ -211,7 +211,7 @@ TEST_F(TimerTest, Stop_SecondLoop_OneCall) {
TEST_F(TimerTest, IsRunning_Started_True) {
// Preconditions
- timer::Timer test_timer(timer_name_, test_task_);
+ timer::Timer test_timer(kTimerName, test_task_);
// Actions
test_timer.Start(timeout_, repeatable_);
// Expects
@@ -220,7 +220,7 @@ TEST_F(TimerTest, IsRunning_Started_True) {
TEST_F(TimerTest, IsRunning_Stoped_False) {
// Preconditions
- timer::Timer test_timer(timer_name_, test_task_);
+ timer::Timer test_timer(kTimerName, test_task_);
// Actions
test_timer.Start(timeout_, repeatable_);
ASSERT_TRUE(test_timer.IsRunning());