Revert r322 since Chrome does not yet support unique_ptr
git-svn-id: http://google-cache-invalidation-api.googlecode.com/svn/trunk@325 1cc9d426-c294-39be-ba72-c0199ca0f247
diff --git a/src/google/cacheinvalidation/impl/basic-system-resources.h b/src/google/cacheinvalidation/impl/basic-system-resources.h
index 6814efd..8fc1a29 100644
--- a/src/google/cacheinvalidation/impl/basic-system-resources.h
+++ b/src/google/cacheinvalidation/impl/basic-system-resources.h
@@ -18,8 +18,6 @@
#ifndef GOOGLE_CACHEINVALIDATION_IMPL_BASIC_SYSTEM_RESOURCES_H_
#define GOOGLE_CACHEINVALIDATION_IMPL_BASIC_SYSTEM_RESOURCES_H_
-#include <memory>
-
#include "google/cacheinvalidation/include/system-resources.h"
#include "google/cacheinvalidation/deps/scoped_ptr.h"
#include "google/cacheinvalidation/impl/run-state.h"
@@ -52,11 +50,11 @@
private:
// Components comprising the system resources. We delegate calls to these as
// appropriate.
- std::unique_ptr<Logger> logger_;
- std::unique_ptr<Scheduler> internal_scheduler_;
- std::unique_ptr<Scheduler> listener_scheduler_;
- std::unique_ptr<NetworkChannel> network_;
- std::unique_ptr<Storage> storage_;
+ scoped_ptr<Logger> logger_;
+ scoped_ptr<Scheduler> internal_scheduler_;
+ scoped_ptr<Scheduler> listener_scheduler_;
+ scoped_ptr<NetworkChannel> network_;
+ scoped_ptr<Storage> storage_;
// The state of the resources.
RunState run_state_;
diff --git a/src/google/cacheinvalidation/impl/invalidation-client-core.h b/src/google/cacheinvalidation/impl/invalidation-client-core.h
index 2595178..d6f66d7 100644
--- a/src/google/cacheinvalidation/impl/invalidation-client-core.h
+++ b/src/google/cacheinvalidation/impl/invalidation-client-core.h
@@ -17,7 +17,6 @@
#ifndef GOOGLE_CACHEINVALIDATION_IMPL_INVALIDATION_CLIENT_CORE_H_
#define GOOGLE_CACHEINVALIDATION_IMPL_INVALIDATION_CLIENT_CORE_H_
-#include <memory>
#include <string>
#include <utility>
@@ -413,10 +412,10 @@
/* A storage layer which schedules the callbacks on the internal scheduler
* thread.
*/
- std::unique_ptr<SafeStorage> storage_;
+ scoped_ptr<SafeStorage> storage_;
/* Statistics objects to track number of sent messages, etc. */
- std::unique_ptr<Statistics> statistics_;
+ scoped_ptr<Statistics> statistics_;
/* Configuration for this instance. */
ClientConfigP config_;
@@ -426,13 +425,13 @@
/* The function for computing the registration and persistence state digests.
*/
- std::unique_ptr<DigestFunction> digest_fn_;
+ scoped_ptr<DigestFunction> digest_fn_;
/* Object maintaining the registration state for this client. */
RegistrationManager registration_manager_;
/* Used to validate messages */
- std::unique_ptr<TiclMessageValidator> msg_validator_;
+ scoped_ptr<TiclMessageValidator> msg_validator_;
/* A smearer to make sure that delays are randomized a little bit. */
Smearer smearer_;
@@ -464,24 +463,24 @@
Time last_message_send_time_;
/* A task for acquiring the token (if the client has no token). */
- std::unique_ptr<AcquireTokenTask> acquire_token_task_;
+ scoped_ptr<AcquireTokenTask> acquire_token_task_;
/* Task for checking if reg summary is out of sync and then sending a
* heartbeat to the server.
*/
- std::unique_ptr<RegSyncHeartbeatTask> reg_sync_heartbeat_task_;
+ scoped_ptr<RegSyncHeartbeatTask> reg_sync_heartbeat_task_;
/* Task for writing the state blob to persistent storage. */
- std::unique_ptr<PersistentWriteTask> persistent_write_task_;
+ scoped_ptr<PersistentWriteTask> persistent_write_task_;
/* A task for periodic heartbeats. */
- std::unique_ptr<HeartbeatTask> heartbeat_task_;
+ scoped_ptr<HeartbeatTask> heartbeat_task_;
/* Task to send all batched messages to the server. */
- std::unique_ptr<BatchingTask> batching_task_;
+ scoped_ptr<BatchingTask> batching_task_;
/* Random number generator for smearing, exp backoff, etc. */
- std::unique_ptr<Random> random_;
+ scoped_ptr<Random> random_;
DISALLOW_COPY_AND_ASSIGN(InvalidationClientCore);
};
diff --git a/src/google/cacheinvalidation/impl/invalidation-client-factory_test.cc b/src/google/cacheinvalidation/impl/invalidation-client-factory_test.cc
index a32f858..ea51664 100644
--- a/src/google/cacheinvalidation/impl/invalidation-client-factory_test.cc
+++ b/src/google/cacheinvalidation/impl/invalidation-client-factory_test.cc
@@ -14,8 +14,6 @@
// Unit tests for the InvalidationClientFactory class.
-#include <memory>
-
#include "google/cacheinvalidation/include/invalidation-client-factory.h"
#include "google/cacheinvalidation/include/invalidation-listener.h"
#include "google/cacheinvalidation/include/types.h"
@@ -80,7 +78,7 @@
}
// The client being tested. Created fresh for each test function.
- std::unique_ptr<InvalidationClientImpl> client;
+ scoped_ptr<InvalidationClientImpl> client;
// A mock invalidation listener.
StrictMock<MockInvalidationListener> listener;
diff --git a/src/google/cacheinvalidation/impl/invalidation-client-impl.h b/src/google/cacheinvalidation/impl/invalidation-client-impl.h
index d529212..2321dcc 100644
--- a/src/google/cacheinvalidation/impl/invalidation-client-impl.h
+++ b/src/google/cacheinvalidation/impl/invalidation-client-impl.h
@@ -17,7 +17,6 @@
#ifndef GOOGLE_CACHEINVALIDATION_IMPL_INVALIDATION_CLIENT_IMPL_H_
#define GOOGLE_CACHEINVALIDATION_IMPL_INVALIDATION_CLIENT_IMPL_H_
-#include <memory>
#include <string>
#include <utility>
@@ -113,7 +112,7 @@
* The listener registered by the application, wrapped in a
* CheckingInvalidationListener.
*/
- std::unique_ptr<CheckingInvalidationListener> listener_;
+ scoped_ptr<CheckingInvalidationListener> listener_;
DISALLOW_COPY_AND_ASSIGN(InvalidationClientImpl);
};
diff --git a/src/google/cacheinvalidation/impl/invalidation-client-impl_test.cc b/src/google/cacheinvalidation/impl/invalidation-client-impl_test.cc
index eac2356..ab72ef2 100644
--- a/src/google/cacheinvalidation/impl/invalidation-client-impl_test.cc
+++ b/src/google/cacheinvalidation/impl/invalidation-client-impl_test.cc
@@ -14,7 +14,6 @@
// Unit tests for the InvalidationClientImpl class.
-#include <memory>
#include <vector>
#include "google/cacheinvalidation/client_test_internal.pb.h"
@@ -172,7 +171,7 @@
ClientConfigP config;
// The client being tested. Created fresh for each test function.
- std::unique_ptr<InvalidationClientImpl> client;
+ scoped_ptr<InvalidationClientImpl> client;
// A mock invalidation listener.
StrictMock<MockInvalidationListener> listener;
@@ -188,7 +187,7 @@
// Tests that GenerateNonce generates a unique nonce on every call.
TEST_F(InvalidationClientImplTest, GenerateNonce) {
// Create a random number generated seeded with the current time.
- std::unique_ptr<Random> random;
+ scoped_ptr<Random> random;
random.reset(new Random(InvalidationClientUtil::GetCurrentTimeMs(
resources->internal_scheduler())));
diff --git a/src/google/cacheinvalidation/impl/protocol-handler.h b/src/google/cacheinvalidation/impl/protocol-handler.h
index d8a1a44..c9e00c4 100644
--- a/src/google/cacheinvalidation/impl/protocol-handler.h
+++ b/src/google/cacheinvalidation/impl/protocol-handler.h
@@ -18,7 +18,6 @@
#define GOOGLE_CACHEINVALIDATION_IMPL_PROTOCOL_HANDLER_H_
#include <map>
-#include <memory>
#include <set>
#include <sstream>
#include <string>
@@ -204,10 +203,10 @@
set<RegistrationSubtree, ProtoCompareLess> pending_reg_subtrees_;
/* Pending initialization message to send to the server, if any. */
- std::unique_ptr<const InitializeMessage> pending_initialize_message_;
+ scoped_ptr<const InitializeMessage> pending_initialize_message_;
/* Pending info message to send to the server, if any. */
- std::unique_ptr<const InfoMessage> pending_info_message_;
+ scoped_ptr<const InfoMessage> pending_info_message_;
DISALLOW_COPY_AND_ASSIGN(Batcher);
};
diff --git a/src/google/cacheinvalidation/impl/protocol-handler_test.cc b/src/google/cacheinvalidation/impl/protocol-handler_test.cc
index 6fcab75..1ca1568 100644
--- a/src/google/cacheinvalidation/impl/protocol-handler_test.cc
+++ b/src/google/cacheinvalidation/impl/protocol-handler_test.cc
@@ -14,8 +14,6 @@
// Unit tests for the ProtocolHandler class.
-#include <memory>
-
#include "google/cacheinvalidation/types.pb.h"
#include "google/cacheinvalidation/include/types.h"
#include "google/cacheinvalidation/deps/gmock.h"
@@ -115,7 +113,7 @@
ProtocolHandlerConfigP config;
// The protocol handler being tested. Created fresh for each test function.
- std::unique_ptr<ProtocolHandler> protocol_handler;
+ scoped_ptr<ProtocolHandler> protocol_handler;
// A mock protocol listener. We make this strict in order to have tight
// control over the interactions between this and the protocol handler.
@@ -126,7 +124,7 @@
// Ticl message validator. We do not mock this, since the correctness of the
// protocol handler depends on it.
- std::unique_ptr<TiclMessageValidator> validator;
+ scoped_ptr<TiclMessageValidator> validator;
// Token and registration summary for the mock listener to return when
// the protocol handler requests them.
@@ -134,13 +132,13 @@
RegistrationSummary summary;
// A smearer to randomize delays.
- std::unique_ptr<Smearer> smearer;
+ scoped_ptr<Smearer> smearer;
// A random number generator.
- std::unique_ptr<Random> random;
+ scoped_ptr<Random> random;
// Batching task for the protocol handler.
- std::unique_ptr<BatchingTask> batching_task;
+ scoped_ptr<BatchingTask> batching_task;
void AddExpectationForHandleMessageSent() {
EXPECT_CALL(listener, HandleMessageSent());
diff --git a/src/google/cacheinvalidation/impl/recurring-task.h b/src/google/cacheinvalidation/impl/recurring-task.h
index f130c5b..492a0f0 100644
--- a/src/google/cacheinvalidation/impl/recurring-task.h
+++ b/src/google/cacheinvalidation/impl/recurring-task.h
@@ -30,8 +30,6 @@
#ifndef GOOGLE_CACHEINVALIDATION_IMPL_RECURRING_TASK_H_
#define GOOGLE_CACHEINVALIDATION_IMPL_RECURRING_TASK_H_
-#include <memory>
-
#include "google/cacheinvalidation/include/system-resources.h"
#include "google/cacheinvalidation/impl/exponential-backoff-delay-generator.h"
#include "google/cacheinvalidation/impl/smearer.h"
@@ -108,7 +106,7 @@
Smearer* smearer_;
/* A delay generator for exponential backoff. */
- std::unique_ptr<ExponentialBackoffDelayGenerator> delay_generator_;
+ scoped_ptr<ExponentialBackoffDelayGenerator> delay_generator_;
/*
* The time after which the task is scheduled first. If no delayGenerator is
diff --git a/src/google/cacheinvalidation/impl/recurring-task_test.cc b/src/google/cacheinvalidation/impl/recurring-task_test.cc
index b92a9c4..cbe45e2 100644
--- a/src/google/cacheinvalidation/impl/recurring-task_test.cc
+++ b/src/google/cacheinvalidation/impl/recurring-task_test.cc
@@ -14,8 +14,6 @@
// Unit tests for the RecurringTask class.
-#include <memory>
-
#include "google/cacheinvalidation/client_test_internal.pb.h"
#include "google/cacheinvalidation/deps/googletest.h"
#include "google/cacheinvalidation/deps/random.h"
@@ -128,16 +126,16 @@
//
// A logger.
- std::unique_ptr<Logger> logger;
+ scoped_ptr<Logger> logger;
// Deterministic scheduler for careful scheduling of the tasks.
- std::unique_ptr<DeterministicScheduler> scheduler;
+ scoped_ptr<DeterministicScheduler> scheduler;
// For randomizing delays.
- std::unique_ptr<Smearer> smearer;
+ scoped_ptr<Smearer> smearer;
// A random number generator that always generates 1.
- std::unique_ptr<Random> random;
+ scoped_ptr<Random> random;
// A delay generator (if used in the test). Not a scoped_ptr since it ends
// up being owned by the RecurringTask.
diff --git a/src/google/cacheinvalidation/impl/registration-manager.h b/src/google/cacheinvalidation/impl/registration-manager.h
index ca3aaa5..3490399 100644
--- a/src/google/cacheinvalidation/impl/registration-manager.h
+++ b/src/google/cacheinvalidation/impl/registration-manager.h
@@ -20,7 +20,6 @@
#define GOOGLE_CACHEINVALIDATION_IMPL_REGISTRATION_MANAGER_H_
#include <map>
-#include <memory>
#include <set>
#include "google/cacheinvalidation/include/system-resources.h"
@@ -168,7 +167,7 @@
private:
/* The set of regisrations that the application has requested for. */
- std::unique_ptr<DigestStore<ObjectIdP> > desired_registrations_;
+ scoped_ptr<DigestStore<ObjectIdP> > desired_registrations_;
/* Statistics objects to track number of sent messages, etc. */
Statistics* statistics_;
diff --git a/src/google/cacheinvalidation/impl/throttle.h b/src/google/cacheinvalidation/impl/throttle.h
index 997df0a..448dcf8 100644
--- a/src/google/cacheinvalidation/impl/throttle.h
+++ b/src/google/cacheinvalidation/impl/throttle.h
@@ -19,7 +19,6 @@
#include <cstddef>
#include <deque>
-#include <memory>
#include <vector>
#include "google/cacheinvalidation/deps/callback.h"
@@ -71,7 +70,7 @@
Scheduler* scheduler_;
// The closure whose calls are throttled.
- std::unique_ptr<Closure> listener_;
+ scoped_ptr<Closure> listener_;
// Whether we've already scheduled a deferred call.
bool timer_scheduled_;
diff --git a/src/google/cacheinvalidation/impl/throttle_test.cc b/src/google/cacheinvalidation/impl/throttle_test.cc
index d0d4283..2df0de0 100644
--- a/src/google/cacheinvalidation/impl/throttle_test.cc
+++ b/src/google/cacheinvalidation/impl/throttle_test.cc
@@ -14,8 +14,6 @@
// Tests the throttle.
-#include <memory>
-
#include "google/cacheinvalidation/deps/googletest.h"
#include "google/cacheinvalidation/impl/proto-helpers.h"
#include "google/cacheinvalidation/impl/throttle.h"
@@ -66,8 +64,8 @@
int call_count_;
Time start_time_;
Time last_call_time_;
- std::unique_ptr<DeterministicScheduler> scheduler_;
- std::unique_ptr<Logger> logger_;
+ scoped_ptr<DeterministicScheduler> scheduler_;
+ scoped_ptr<Logger> logger_;
RepeatedPtrField<RateLimitP> rate_limits_;
static const int kMessagesPerSecond;
@@ -93,7 +91,7 @@
Closure* listener =
NewPermanentCallback(this, &ThrottleTest::IncrementCounter);
- std::unique_ptr<Throttle> throttle(
+ scoped_ptr<Throttle> throttle(
new Throttle(rate_limits_, scheduler_.get(), listener));
// The first time we fire(), it should call right away.
@@ -170,7 +168,7 @@
NewPermanentCallback(this, &ThrottleTest::IncrementAndCheckRateLimits);
// Throttler allowing one call per second and six per minute.
- std::unique_ptr<Throttle> throttle(
+ scoped_ptr<Throttle> throttle(
new Throttle(rate_limits_, scheduler_.get(), listener));
// For five minutes, call Fire() every ten milliseconds, and make sure the
diff --git a/src/google/cacheinvalidation/test/test-utils.h b/src/google/cacheinvalidation/test/test-utils.h
index 8f6cccf..4c55803 100644
--- a/src/google/cacheinvalidation/test/test-utils.h
+++ b/src/google/cacheinvalidation/test/test-utils.h
@@ -19,8 +19,6 @@
#ifndef GOOGLE_CACHEINVALIDATION_TEST_TEST_UTILS_H_
#define GOOGLE_CACHEINVALIDATION_TEST_TEST_UTILS_H_
-#include <memory>
-
#include "google/cacheinvalidation/client_protocol.pb.h"
#include "google/cacheinvalidation/include/invalidation-listener.h"
#include "google/cacheinvalidation/include/types.h"
@@ -293,10 +291,10 @@
MockStorage* storage;
// System resources (owned by the test).
- std::unique_ptr<BasicSystemResources> resources;
+ scoped_ptr<BasicSystemResources> resources;
// Statistics object for counting occurrences of different types of events.
- std::unique_ptr<Statistics> statistics;
+ scoped_ptr<Statistics> statistics;
// Message callback installed by the protocol handler. Captured by the mock
// network.
@@ -304,7 +302,7 @@
// Registration summary to be placed in messages from the client to the server
// and vice-versa.
- std::unique_ptr<RegistrationSummary> reg_summary;
+ scoped_ptr<RegistrationSummary> reg_summary;
};
// Creates an action InvokeAndDeleteClosure<k> that invokes the kth closure and