summaryrefslogtreecommitdiffstats
path: root/storageframework
diff options
context:
space:
mode:
authorHaavard <havardpe@yahoo-inc.com>2017-03-20 13:04:33 +0000
committerHaavard <havardpe@yahoo-inc.com>2017-03-27 09:53:26 +0000
commit23abed1a0bc4f4c5ea47b43fc7ea0645e63a26e6 (patch)
tree6d943bbe31738f7e9b84979e4fd63dfd76eef580 /storageframework
parent8844ccb7297e8a5120dd903c85e923f2f93aa693 (diff)
remove most usage of LinkedPtr from vespa
Diffstat (limited to 'storageframework')
-rw-r--r--storageframework/src/tests/memory/memorymanagertest.cpp6
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.cpp4
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h2
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.cpp6
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h2
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.cpp6
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.h2
-rw-r--r--storageframework/src/vespa/storageframework/generic/memory/memoryallocationtype.h4
-rw-r--r--storageframework/src/vespa/storageframework/generic/thread/tickingthread.cpp4
-rw-r--r--storageframework/src/vespa/storageframework/generic/thread/tickingthread.h5
10 files changed, 20 insertions, 21 deletions
diff --git a/storageframework/src/tests/memory/memorymanagertest.cpp b/storageframework/src/tests/memory/memorymanagertest.cpp
index 678a40a4b44..50bca7b5b58 100644
--- a/storageframework/src/tests/memory/memorymanagertest.cpp
+++ b/storageframework/src/tests/memory/memorymanagertest.cpp
@@ -260,8 +260,8 @@ struct MemoryManagerLoadGiver : public document::Runnable,
uint32_t _failed;
uint32_t _ok;
uint32_t _reduced;
- typedef vespalib::LinkedPtr<MemoryToken> MemoryTokenPtr;
- std::vector<MemoryTokenPtr> _tokens;
+ using MemoryTokenUP = std::unique_ptr<MemoryToken>;
+ std::vector<MemoryTokenUP> _tokens;
vespalib::Lock _cacheLock;
MemoryManagerLoadGiver(
@@ -302,7 +302,7 @@ struct MemoryManagerLoadGiver : public document::Runnable,
++_ok;
}
uint32_t index = randomizer.nextUint32(0, _tokens.size() - 1);
- _tokens[index] = MemoryTokenPtr(token.release());
+ _tokens[index] = MemoryTokenUP(token.release());
}
}
};
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.cpp
index 01f1d2583be..c640a5840a6 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.cpp
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.cpp
@@ -161,9 +161,9 @@ ComponentRegisterImpl::registerUpdateHook(vespalib::stringref name,
SecondTime period)
{
vespalib::LockGuard lock(_componentLock);
- metrics::UpdateHook::LP hookPtr(new MetricHookWrapper(name, hook));
- _hooks.push_back(hookPtr);
+ metrics::UpdateHook::UP hookPtr(new MetricHookWrapper(name, hook));
_metricManager->addMetricUpdateHook(*hookPtr, period.getTime());
+ _hooks.push_back(std::move(hookPtr));
}
metrics::MetricLockGuard
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h b/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h
index 8e472eb9c08..8c3ff58b4db 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h
@@ -48,7 +48,7 @@ class ComponentRegisterImpl : public virtual ComponentRegister,
std::vector<ManagedComponent*> _components;
metrics::MetricSet _topMetricSet;
- std::vector<vespalib::LinkedPtr<metrics::UpdateHook>> _hooks;
+ std::vector<std::unique_ptr<metrics::UpdateHook>> _hooks;
metrics::MetricManager* _metricManager;
MemoryManagerInterface* _memoryManager;
Clock* _clock;
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.cpp
index 7ef2b62ecc8..0ce71866f93 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.cpp
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.cpp
@@ -95,7 +95,7 @@ const MemoryAllocationType&
MemoryManager::registerAllocationType(const MemoryAllocationType& type)
{
vespalib::LockGuard lock(_typeLock);
- _types[type.getName()] = MemoryAllocationType::LP(
+ _types[type.getName()] = MemoryAllocationType::UP(
new MemoryAllocationType(type));
return *_types[type.getName()];
}
@@ -104,7 +104,7 @@ const MemoryAllocationType&
MemoryManager::getAllocationType(const std::string& name) const
{
vespalib::LockGuard lock(_typeLock);
- std::map<std::string, MemoryAllocationType::LP>::const_iterator it(
+ std::map<std::string, MemoryAllocationType::UP>::const_iterator it(
_types.find(name));
if (it == _types.end()) {
throw vespalib::IllegalArgumentException(
@@ -118,7 +118,7 @@ MemoryManager::getAllocationTypes() const
{
vespalib::LockGuard lock(_typeLock);
std::vector<const MemoryAllocationType*> types;
- for(std::map<std::string, MemoryAllocationType::LP>::const_iterator it
+ for(std::map<std::string, MemoryAllocationType::UP>::const_iterator it
= _types.begin(); it != _types.end(); ++it)
{
types.push_back(it->second.get());
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h
index 8ce3769fd1c..0db8b7ab4b0 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h
@@ -130,7 +130,7 @@ class MemoryManager : public vespalib::Printable,
{
AllocationLogic::UP _logic;
vespalib::Lock _typeLock;
- std::map<std::string, MemoryAllocationType::LP> _types;
+ std::map<std::string, MemoryAllocationType::UP> _types;
public:
typedef std::unique_ptr<MemoryManager> UP;
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.cpp
index 938c604e053..36f85d25ff1 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.cpp
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.cpp
@@ -11,7 +11,7 @@ const MemoryAllocationType&
NoMemoryManager::registerAllocationType(const MemoryAllocationType& type)
{
vespalib::LockGuard lock(_typeLock);
- _types[type.getName()] = MemoryAllocationType::LP(
+ _types[type.getName()] = MemoryAllocationType::UP(
new MemoryAllocationType(type));
return *_types[type.getName()];
}
@@ -20,7 +20,7 @@ const MemoryAllocationType&
NoMemoryManager::getAllocationType(const std::string& name) const
{
vespalib::LockGuard lock(_typeLock);
- std::map<std::string, MemoryAllocationType::LP>::const_iterator it(
+ std::map<std::string, MemoryAllocationType::UP>::const_iterator it(
_types.find(name));
if (it == _types.end()) {
throw vespalib::IllegalArgumentException(
@@ -34,7 +34,7 @@ NoMemoryManager::getAllocationTypes() const
{
vespalib::LockGuard lock(_typeLock);
std::vector<const MemoryAllocationType*> types;
- for(std::map<std::string, MemoryAllocationType::LP>::const_iterator it
+ for(std::map<std::string, MemoryAllocationType::UP>::const_iterator it
= _types.begin(); it != _types.end(); ++it)
{
types.push_back(it->second.get());
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.h b/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.h
index 0be8e41a05f..870d735b113 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.h
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.h
@@ -37,7 +37,7 @@ public:
class NoMemoryManager : public MemoryManagerInterface
{
vespalib::Lock _typeLock;
- std::map<std::string, MemoryAllocationType::LP> _types;
+ std::map<std::string, MemoryAllocationType::UP> _types;
public:
typedef std::unique_ptr<NoMemoryManager> UP;
diff --git a/storageframework/src/vespa/storageframework/generic/memory/memoryallocationtype.h b/storageframework/src/vespa/storageframework/generic/memory/memoryallocationtype.h
index 13ac09604bf..94679212179 100644
--- a/storageframework/src/vespa/storageframework/generic/memory/memoryallocationtype.h
+++ b/storageframework/src/vespa/storageframework/generic/memory/memoryallocationtype.h
@@ -18,13 +18,13 @@
#pragma once
#include <string>
-#include <vespa/vespalib/util/linkedptr.h>
+#include <memory>
namespace storage {
namespace framework {
struct MemoryAllocationType {
- typedef vespalib::LinkedPtr<MemoryAllocationType> LP;
+ using UP = std::unique_ptr<MemoryAllocationType>;
enum Flags {
NONE = 0x00,
diff --git a/storageframework/src/vespa/storageframework/generic/thread/tickingthread.cpp b/storageframework/src/vespa/storageframework/generic/thread/tickingthread.cpp
index 2c41e05d72c..d425ff3a1d8 100644
--- a/storageframework/src/vespa/storageframework/generic/thread/tickingthread.cpp
+++ b/storageframework/src/vespa/storageframework/generic/thread/tickingthread.cpp
@@ -187,12 +187,12 @@ public:
}
virtual TickingLockGuard freezeAllTicks() {
- return TickingLockGuard(vespalib::LinkedPtr<TickingLockGuard::Impl>(
+ return TickingLockGuard(std::unique_ptr<TickingLockGuard::Impl>(
new FreezeGuard(*this)));
}
virtual TickingLockGuard freezeCriticalTicks() {
- return TickingLockGuard(vespalib::LinkedPtr<TickingLockGuard::Impl>(
+ return TickingLockGuard(std::unique_ptr<TickingLockGuard::Impl>(
new CriticalGuard(_monitor)));
}
diff --git a/storageframework/src/vespa/storageframework/generic/thread/tickingthread.h b/storageframework/src/vespa/storageframework/generic/thread/tickingthread.h
index 8357e50f401..16a67cf709c 100644
--- a/storageframework/src/vespa/storageframework/generic/thread/tickingthread.h
+++ b/storageframework/src/vespa/storageframework/generic/thread/tickingthread.h
@@ -21,7 +21,6 @@
#include <memory>
#include <vespa/storageframework/generic/clock/time.h>
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/util/linkedptr.h>
#include <vespa/vespalib/util/sync.h>
namespace storage {
@@ -63,10 +62,10 @@ struct TickingLockGuard {
virtual ~Impl() {}
virtual void broadcast() = 0;
};
- TickingLockGuard(vespalib::LinkedPtr<Impl> impl) : _impl(impl) {}
+ TickingLockGuard(std::unique_ptr<Impl> impl) : _impl(std::move(impl)) {}
void broadcast() { _impl->broadcast(); }
private:
- vespalib::LinkedPtr<Impl> _impl;
+ std::unique_ptr<Impl> _impl;
};
struct ThreadLock {