authorization_manager.h   authorization_manager.h 
skipping to change at line 94 skipping to change at line 94
void addAuthorizedPrincipal(Principal* principal); void addAuthorizedPrincipal(Principal* principal);
// Returns the authenticated principal with the given name. Return s NULL // Returns the authenticated principal with the given name. Return s NULL
// if no such user is found. // if no such user is found.
// Ownership of the returned Principal remains with _authenticatedP rincipals // Ownership of the returned Principal remains with _authenticatedP rincipals
Principal* lookupPrincipal(const PrincipalName& name); Principal* lookupPrincipal(const PrincipalName& name);
// Gets an iterator over the names of all authenticated principals stored in this manager. // Gets an iterator over the names of all authenticated principals stored in this manager.
PrincipalSet::NameIterator getAuthenticatedPrincipalNames(); PrincipalSet::NameIterator getAuthenticatedPrincipalNames();
// Returns a string representing all logged-in principals on the cu
rrent session.
// WARNING: this string will contain NUL bytes so don't call c_str(
)!
std::string getAuthenticatedPrincipalNamesToken();
// Removes any authenticated principals whose authorization credent ials came from the given // Removes any authenticated principals whose authorization credent ials came from the given
// database, and revokes any privileges that were granted via that principal. // database, and revokes any privileges that were granted via that principal.
void logoutDatabase(const std::string& dbname); void logoutDatabase(const std::string& dbname);
// Grant this connection the given privilege. // Grant this connection the given privilege.
Status acquirePrivilege(const Privilege& privilege, Status acquirePrivilege(const Privilege& privilege,
const PrincipalName& authorizingPrincipal); const PrincipalName& authorizingPrincipal);
// Adds a new principal with the given principal name and authorize s it with full access. // Adds a new principal with the given principal name and authorize s it with full access.
// Used to grant internal threads full access. // Used to grant internal threads full access.
 End of changes. 1 change blocks. 
0 lines changed or deleted 6 lines changed or added


 counters.h   counters.h 
// Copyright 2012 the V8 project authors. All rights reserved. // counters.h
// Redistribution and use in source and binary forms, with or without /*
// modification, are permitted provided that the following conditions are * Copyright (C) 2010 10gen Inc.
// met: *
// * This program is free software: you can redistribute it and/or modify
// * Redistributions of source code must retain the above copyright * it under the terms of the GNU Affero General Public License, version
// notice, this list of conditions and the following disclaimer. 3,
// * Redistributions in binary form must reproduce the above * as published by the Free Software Foundation.
// copyright notice, this list of conditions and the following *
// disclaimer in the documentation and/or other materials provided * This program is distributed in the hope that it will be useful,
// with the distribution. * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * Neither the name of Google Inc. nor the names of its * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// contributors may be used to endorse or promote products derived * GNU Affero General Public License for more details.
// from this software without specific prior written permission. *
// * You should have received a copy of the GNU Affero General Public Lice
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS nse
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * along with this program. If not, see <http://www.gnu.org/licenses/>.
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #pragma once
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #include "mongo/pch.h"
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #include "../jsobj.h"
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #include "../../util/net/message.h"
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #include "../../util/processinfo.h"
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../../util/concurrency/spin_lock.h"
#include "mongo/db/pdfile.h"
#ifndef V8_COUNTERS_H_
#define V8_COUNTERS_H_ namespace mongo {
#include "../include/v8.h" /**
#include "allocation.h" * for storing operation counters
* note: not thread safe. ok with that for speed
namespace v8 { */
namespace internal { class OpCounters {
public:
// StatsCounters is an interface for plugging into external
// counters for monitoring. Counters can be looked up and OpCounters();
// manipulated by name. void incInsertInWriteLock(int n) { _insert.x += n; }
void gotInsert() { _insert++; }
class StatsTable { void gotQuery() { _query++; }
public: void gotUpdate() { _update++; }
// Register an application-defined function where void gotDelete() { _delete++; }
// counters can be looked up. void gotGetMore() { _getmore++; }
void SetCounterFunction(CounterLookupCallback f) { void gotCommand() { _command++; }
lookup_function_ = f;
} void gotOp( int op , bool isCommand );
// Register an application-defined function to create BSONObj getObj() const;
// a histogram for passing to the AddHistogramSample function
void SetCreateHistogramFunction(CreateHistogramCallback f) { // thse are used by snmp, and other things, do not remove
create_histogram_function_ = f; const AtomicUInt * getInsert() const { return &_insert; }
} const AtomicUInt * getQuery() const { return &_query; }
const AtomicUInt * getUpdate() const { return &_update; }
// Register an application-defined function to add a sample const AtomicUInt * getDelete() const { return &_delete; }
// to a histogram created with CreateHistogram function const AtomicUInt * getGetMore() const { return &_getmore; }
void SetAddHistogramSampleFunction(AddHistogramSampleCallback f) { const AtomicUInt * getCommand() const { return &_command; }
add_histogram_sample_function_ = f;
} private:
void _checkWrap();
bool HasCounterFunction() const {
return lookup_function_ != NULL; // todo: there will be a lot of cache line contention on these. ne
} ed to do something
// else eventually.
// Lookup the location of a counter by name. If the lookup AtomicUInt _insert;
// is successful, returns a non-NULL pointer for writing the AtomicUInt _query;
// value of the counter. Each thread calling this function AtomicUInt _update;
// may receive a different location to store it's counter. AtomicUInt _delete;
// The return value must not be cached and re-used across AtomicUInt _getmore;
// threads, although a single thread is free to cache it. AtomicUInt _command;
int* FindLocation(const char* name) { };
if (!lookup_function_) return NULL;
return lookup_function_(name); extern OpCounters globalOpCounters;
} extern OpCounters replOpCounters;
// Create a histogram by name. If the create is successful, class NetworkCounter {
// returns a non-NULL pointer for use with AddHistogramSample public:
// function. min and max define the expected minimum and maximum NetworkCounter() : _bytesIn(0), _bytesOut(0), _requests(0), _overfl
// sample values. buckets is the maximum number of buckets ows(0) {}
// that the samples will be grouped into. void hit( long long bytesIn , long long bytesOut );
void* CreateHistogram(const char* name, void append( BSONObjBuilder& b );
int min, private:
int max, long long _bytesIn;
size_t buckets) { long long _bytesOut;
if (!create_histogram_function_) return NULL; long long _requests;
return create_histogram_function_(name, min, max, buckets);
}
// Add a sample to a histogram created with the CreateHistogram
// function.
void AddHistogramSample(void* histogram, int sample) {
if (!add_histogram_sample_function_) return;
return add_histogram_sample_function_(histogram, sample);
}
private:
StatsTable();
CounterLookupCallback lookup_function_;
CreateHistogramCallback create_histogram_function_;
AddHistogramSampleCallback add_histogram_sample_function_;
friend class Isolate;
DISALLOW_COPY_AND_ASSIGN(StatsTable);
};
// StatsCounters are dynamically created values which can be tracked in
// the StatsTable. They are designed to be lightweight to create and
// easy to use.
//
// Internally, a counter represents a value in a row of a StatsTable.
// The row has a 32bit value for each process/thread in the table and also
// a name (stored in the table metadata). Since the storage location can b
e
// thread-specific, this class cannot be shared across threads.
//
// This class is designed to be POD initialized. It will be registered wit
h
// the counter system on first use. For example:
// StatsCounter c = { "c:myctr", NULL, false };
struct StatsCounter {
const char* name_;
int* ptr_;
bool lookup_done_;
// Sets the counter to a specific value.
void Set(int value) {
int* loc = GetPtr();
if (loc) *loc = value;
}
// Increments the counter.
void Increment() {
int* loc = GetPtr();
if (loc) (*loc)++;
}
void Increment(int value) {
int* loc = GetPtr();
if (loc)
(*loc) += value;
}
// Decrements the counter.
void Decrement() {
int* loc = GetPtr();
if (loc) (*loc)--;
}
void Decrement(int value) {
int* loc = GetPtr();
if (loc) (*loc) -= value;
}
// Is this counter enabled?
// Returns false if table is full.
bool Enabled() {
return GetPtr() != NULL;
}
// Get the internal pointer to the counter. This is used
// by the code generator to emit code that manipulates a
// given counter without calling the runtime system.
int* GetInternalPointer() {
int* loc = GetPtr();
ASSERT(loc != NULL);
return loc;
}
protected:
// Returns the cached address of this counter location.
int* GetPtr() {
if (lookup_done_) return ptr_;
lookup_done_ = true;
ptr_ = FindLocationInStatsTable();
return ptr_;
}
private:
int* FindLocationInStatsTable() const;
};
// StatsCounterTimer t = { { L"t:foo", NULL, false }, 0, 0 };
struct StatsCounterTimer {
StatsCounter counter_;
int64_t start_time_;
int64_t stop_time_;
// Start the timer.
void Start();
// Stop the timer and record the results.
void Stop();
// Returns true if the timer is running.
bool Running() {
return counter_.Enabled() && start_time_ != 0 && stop_time_ == 0;
}
};
// A Histogram represents a dynamically created histogram in the StatsTable
.
//
// This class is designed to be POD initialized. It will be registered wit
h
// the histogram system on first use. For example:
// Histogram h = { "myhist", 0, 10000, 50, NULL, false };
struct Histogram {
const char* name_;
int min_;
int max_;
int num_buckets_;
void* histogram_;
bool lookup_done_;
// Add a single sample to this histogram.
void AddSample(int sample);
// Returns true if this histogram is enabled.
bool Enabled() {
return GetHistogram() != NULL;
}
protected:
// Returns the handle to the histogram.
void* GetHistogram() {
if (!lookup_done_) {
lookup_done_ = true;
histogram_ = CreateHistogram();
}
return histogram_;
}
private:
void* CreateHistogram() const;
};
// A HistogramTimer allows distributions of results to be created
// HistogramTimer t = { {L"foo", 0, 10000, 50, NULL, false}, 0, 0 };
struct HistogramTimer {
Histogram histogram_;
int64_t start_time_;
int64_t stop_time_;
// Start the timer.
void Start();
// Stop the timer and record the results.
void Stop();
// Returns true if the timer is running.
bool Running() {
return histogram_.Enabled() && (start_time_ != 0) && (stop_time_ == 0);
}
};
// Helper class for scoping a HistogramTimer.
class HistogramTimerScope BASE_EMBEDDED {
public:
explicit HistogramTimerScope(HistogramTimer* timer) :
timer_(timer) {
timer_->Start();
}
~HistogramTimerScope() {
timer_->Stop();
}
private:
HistogramTimer* timer_;
};
} } // namespace v8::internal long long _overflows;
#endif // V8_COUNTERS_H_ SpinLock _lock;
};
extern NetworkCounter networkCounter;
}
 End of changes. 3 change blocks. 
273 lines changed or deleted 86 lines changed or added


 document.h   document.h 
skipping to change at line 165 skipping to change at line 165
// TODO: replace with logical equality once all current usages are fixed // TODO: replace with logical equality once all current usages are fixed
bool operator== (const Document& lhs) const { return _storage == lh s._storage; } bool operator== (const Document& lhs) const { return _storage == lh s._storage; }
explicit Document(const DocumentStorage* ptr) : _storage(ptr) {}; explicit Document(const DocumentStorage* ptr) : _storage(ptr) {};
private: private:
friend class FieldIterator; friend class FieldIterator;
friend class ValueStorage; friend class ValueStorage;
friend class MutableDocument; friend class MutableDocument;
friend class MutableValue;
const DocumentStorage& storage() const { const DocumentStorage& storage() const {
return (_storage ? *_storage : DocumentStorage::emptyDoc()); return (_storage ? *_storage : DocumentStorage::emptyDoc());
} }
intrusive_ptr<const DocumentStorage> _storage; intrusive_ptr<const DocumentStorage> _storage;
}; };
/** This class is returned by MutableDocument to allow you to modify it s values. /** This class is returned by MutableDocument to allow you to modify it s values.
* You are not allowed to hold variables of this type (enforced by the type system). * You are not allowed to hold variables of this type (enforced by the type system).
*/ */
skipping to change at line 197 skipping to change at line 198
private: private:
friend class MutableDocument; friend class MutableDocument;
/// can only be constructed or copied by self and friends /// can only be constructed or copied by self and friends
MutableValue(const MutableValue& other): _val(other._val) {} MutableValue(const MutableValue& other): _val(other._val) {}
explicit MutableValue(Value& val): _val(val) {} explicit MutableValue(Value& val): _val(val) {}
/// Used by MutableDocument(MutableValue) /// Used by MutableDocument(MutableValue)
const RefCountable*& getDocPtr() { const RefCountable*& getDocPtr() {
if (_val.getType() != Object) if (_val.getType() != Object || _val._storage.genericRCPtr == N
*this = Value(Document()); ULL) {
// If the current value isn't an object we replace it with
a Object-typed Value.
// Note that we can't just use Document() here because that
is a NULL pointer and
// Value doesn't refcount NULL pointers. This led to a memo
ry leak (SERVER-10554)
// because MutableDocument::newStorage() would set a non-NU
LL pointer into the Value
// without setting the refCounter bit. While allocating a D
ocumentStorage here could
// result in an allocation where none is needed, in practic
e this is only called
// when we are about to add a field to the sub-document so
this just changes where
// the allocation is done.
_val = Value(Document(new DocumentStorage()));
}
return _val._storage.genericRCPtr; return _val._storage.genericRCPtr;
} }
MutableValue& operator= (const MutableValue&); // not assignable wi th another MutableValue MutableValue& operator= (const MutableValue&); // not assignable wi th another MutableValue
Value& _val; Value& _val;
}; };
/** MutableDocument is a Document builder that supports both adding and updating fields. /** MutableDocument is a Document builder that supports both adding and updating fields.
 End of changes. 2 change blocks. 
2 lines changed or deleted 20 lines changed or added


 engine.h   engine.h 
skipping to change at line 138 skipping to change at line 138
/** /**
* if any changes are made to .system.js, call this * if any changes are made to .system.js, call this
* right now its just global - slightly inefficient, but a lot simp ler * right now its just global - slightly inefficient, but a lot simp ler
*/ */
static void storedFuncMod(); static void storedFuncMod();
static void validateObjectIdString(const string& str); static void validateObjectIdString(const string& str);
/** increments the number of times a scope was used */ /** increments the number of times a scope was used */
void incTimeUsed() { ++_numTimeUsed; } void incTimesUsed() { ++_numTimesUsed; }
/** gets the number of times a scope was used */ /** gets the number of times a scope was used */
int getTimeUsed() { return _numTimeUsed; } int getTimesUsed() { return _numTimesUsed; }
/** return true if last invoke() return'd native code */ /** return true if last invoke() return'd native code */
virtual bool isLastRetNativeCode() { return _lastRetIsNativeCode; } virtual bool isLastRetNativeCode() { return _lastRetIsNativeCode; }
class NoDBAccess { class NoDBAccess {
Scope* _s; Scope* _s;
public: public:
NoDBAccess(Scope* s) : _s(s) { NoDBAccess(Scope* s) : _s(s) {
} }
~NoDBAccess() { ~NoDBAccess() {
skipping to change at line 171 skipping to change at line 171
friend class PooledScope; friend class PooledScope;
virtual FunctionCacheMap& getFunctionCache() { return _cachedFuncti ons; } virtual FunctionCacheMap& getFunctionCache() { return _cachedFuncti ons; }
virtual ScriptingFunction _createFunction(const char* code, virtual ScriptingFunction _createFunction(const char* code,
ScriptingFunction functio nNumber = 0) = 0; ScriptingFunction functio nNumber = 0) = 0;
string _localDBName; string _localDBName;
long long _loadedVersion; long long _loadedVersion;
set<string> _storedNames; set<string> _storedNames;
static long long _lastVersion; static long long _lastVersion;
FunctionCacheMap _cachedFunctions; FunctionCacheMap _cachedFunctions;
int _numTimeUsed; int _numTimesUsed;
bool _lastRetIsNativeCode; // v8 only: set to true if eval'd script returns a native func bool _lastRetIsNativeCode; // v8 only: set to true if eval'd script returns a native func
}; };
class ScriptEngine : boost::noncopyable { class ScriptEngine : boost::noncopyable {
public: public:
ScriptEngine(); ScriptEngine();
virtual ~ScriptEngine(); virtual ~ScriptEngine();
virtual Scope* newScope() { virtual Scope* newScope() {
return createScope(); return createScope();
} }
virtual void runTest() = 0; virtual void runTest() = 0;
virtual bool utf8Ok() const = 0; virtual bool utf8Ok() const = 0;
static void setup(); static void setup();
/** gets a scope from the pool or a new one if pool is empty /** gets a scope from the pool or a new one if pool is empty
* @param pool An identifier for the pool, usually the db name * @param db The db name
* @param scopeType A unique id to limit scope sharing.
* This must include authenticated users.
* @return the scope * @return the scope
*/ */
auto_ptr<Scope> getPooledScope(const string& pool, const string& sc auto_ptr<Scope> getPooledScope(const string& db, const string& scop
opeType); eType);
/**
* call this method to release some JS resources when a thread is d
one
*/
void threadDone();
void setScopeInitCallback(void (*func)(Scope&)) { _scopeInitCallbac k = func; } void setScopeInitCallback(void (*func)(Scope&)) { _scopeInitCallbac k = func; }
static void setConnectCallback(void (*func)(DBClientWithCommands&)) { static void setConnectCallback(void (*func)(DBClientWithCommands&)) {
_connectCallback = func; _connectCallback = func;
} }
static void runConnectCallback(DBClientWithCommands& c) { static void runConnectCallback(DBClientWithCommands& c) {
if (_connectCallback) if (_connectCallback)
_connectCallback(c); _connectCallback(c);
} }
 End of changes. 5 change blocks. 
12 lines changed or deleted 8 lines changed or added


 progress_meter.h   progress_meter.h 
skipping to change at line 33 skipping to change at line 33
namespace mongo { namespace mongo {
class ProgressMeter : boost::noncopyable { class ProgressMeter : boost::noncopyable {
public: public:
ProgressMeter(unsigned long long total, ProgressMeter(unsigned long long total,
int secondsBetween = 3, int secondsBetween = 3,
int checkInterval = 100, int checkInterval = 100,
std::string units = "", std::string units = "",
std::string name = "Progress") std::string name = "Progress")
: _units(units) : _showTotal(true),
, _name(name) { _units(units),
_name(name) {
reset( total , secondsBetween , checkInterval ); reset( total , secondsBetween , checkInterval );
} }
ProgressMeter() : _active(0), _units(""), _name("Progress") {} ProgressMeter() : _active(0), _showTotal(true), _units(""), _name(" Progress") {}
// typically you do ProgressMeterHolder // typically you do ProgressMeterHolder
void reset( unsigned long long total , int secondsBetween = 3 , int checkInterval = 100 ); void reset( unsigned long long total , int secondsBetween = 3 , int checkInterval = 100 );
void finished() { _active = 0; } void finished() { _active = 0; }
bool isActive() const { return _active; } bool isActive() const { return _active; }
/** /**
* @param n how far along we are relative to the total # we set in CurOp::setMessage * @param n how far along we are relative to the total # we set in CurOp::setMessage
* @return if row was printed * @return if row was printed
skipping to change at line 68 skipping to change at line 69
void setTotalWhileRunning( unsigned long long total ) { void setTotalWhileRunning( unsigned long long total ) {
_total = total; _total = total;
} }
unsigned long long done() const { return _done; } unsigned long long done() const { return _done; }
unsigned long long hits() const { return _hits; } unsigned long long hits() const { return _hits; }
unsigned long long total() const { return _total; } unsigned long long total() const { return _total; }
void showTotal(bool doShow) {
_showTotal = doShow;
}
std::string toString() const; std::string toString() const;
bool operator==( const ProgressMeter& other ) const { return this = = &other; } bool operator==( const ProgressMeter& other ) const { return this = = &other; }
private: private:
bool _active; bool _active;
unsigned long long _total; unsigned long long _total;
bool _showTotal;
int _secondsBetween; int _secondsBetween;
int _checkInterval; int _checkInterval;
unsigned long long _done; unsigned long long _done;
unsigned long long _hits; unsigned long long _hits;
int _lastTime; int _lastTime;
std::string _units; std::string _units;
std::string _name; std::string _name;
}; };
 End of changes. 4 change blocks. 
3 lines changed or deleted 9 lines changed or added


 shard.h   shard.h 
skipping to change at line 310 skipping to change at line 310
* Note: This is *dangerous* if we have GLE state. * Note: This is *dangerous* if we have GLE state.
*/ */
static void releaseMyConnections(); static void releaseMyConnections();
/** /**
* Clears all connections in the sharded pool, including connection s in the * Clears all connections in the sharded pool, including connection s in the
* thread local storage pool of the current thread. * thread local storage pool of the current thread.
*/ */
static void clearPool(); static void clearPool();
/**
* Forgets a namespace to prevent future versioning.
*/
static void forgetNS( const string& ns );
private: private:
void _init(); void _init();
void _finishInit(); void _finishInit();
bool _finishedInit; bool _finishedInit;
string _addr; string _addr;
string _ns; string _ns;
ChunkManagerPtr _manager; ChunkManagerPtr _manager;
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 value_internal.h   value_internal.h 
skipping to change at line 91 skipping to change at line 91
memcpy(&oid, &o, sizeof(OID)); memcpy(&oid, &o, sizeof(OID));
BOOST_STATIC_ASSERT(sizeof(OID) == sizeof(oid)); BOOST_STATIC_ASSERT(sizeof(OID) == sizeof(oid));
} }
ValueStorage(const ValueStorage& rhs) { ValueStorage(const ValueStorage& rhs) {
memcpy(this, &rhs, sizeof(*this)); memcpy(this, &rhs, sizeof(*this));
memcpyed(); memcpyed();
} }
~ValueStorage() { ~ValueStorage() {
DEV verifyRefCountingIfShould();
if (refCounter) if (refCounter)
intrusive_ptr_release(genericRCPtr); intrusive_ptr_release(genericRCPtr);
DEV memset(this, 0xee, sizeof(*this)); DEV memset(this, 0xee, sizeof(*this));
} }
ValueStorage& operator= (ValueStorage rhsCopy) { ValueStorage& operator= (ValueStorage rhsCopy) {
this->swap(rhsCopy); this->swap(rhsCopy);
return *this; return *this;
} }
void swap(ValueStorage& rhs) { void swap(ValueStorage& rhs) {
// Don't need to update ref-counts because they will be the sam e in the end // Don't need to update ref-counts because they will be the sam e in the end
char temp[sizeof(ValueStorage)]; char temp[sizeof(ValueStorage)];
memcpy(temp, this, sizeof(*this)); memcpy(temp, this, sizeof(*this));
memcpy(this, &rhs, sizeof(*this)); memcpy(this, &rhs, sizeof(*this));
memcpy(&rhs, temp, sizeof(*this)); memcpy(&rhs, temp, sizeof(*this));
} }
/// Call this after memcpying to update ref counts if needed /// Call this after memcpying to update ref counts if needed
void memcpyed() const { void memcpyed() const {
DEV verifyRefCountingIfShould();
if (refCounter) if (refCounter)
intrusive_ptr_add_ref(genericRCPtr); intrusive_ptr_add_ref(genericRCPtr);
} }
/// These are only to be called during Value construction on an emp ty Value /// These are only to be called during Value construction on an emp ty Value
void putString(const StringData& s); void putString(const StringData& s);
void putVector(const RCVector* v); void putVector(const RCVector* v);
void putDocument(const Document& d); void putDocument(const Document& d);
void putRegEx(const BSONRegEx& re); void putRegEx(const BSONRegEx& re);
void putBinData(const BSONBinData& bd) { void putBinData(const BSONBinData& bd) {
skipping to change at line 142 skipping to change at line 144
putRefCountable(new RCCodeWScope(cws.code.toString(), cws.scope )); putRefCountable(new RCCodeWScope(cws.code.toString(), cws.scope ));
} }
void putRefCountable(intrusive_ptr<const RefCountable> ptr) { void putRefCountable(intrusive_ptr<const RefCountable> ptr) {
genericRCPtr = ptr.get(); genericRCPtr = ptr.get();
if (genericRCPtr) { if (genericRCPtr) {
intrusive_ptr_add_ref(genericRCPtr); intrusive_ptr_add_ref(genericRCPtr);
refCounter = true; refCounter = true;
} }
DEV verifyRefCountingIfShould();
} }
StringData getString() const { StringData getString() const {
if (shortStr) { if (shortStr) {
return StringData(shortStrStorage, shortStrSize); return StringData(shortStrStorage, shortStrSize);
} }
else { else {
dassert(typeid(*genericRCPtr) == typeid(const RCString)); dassert(typeid(*genericRCPtr) == typeid(const RCString));
const RCString* stringPtr = static_cast<const RCString*>(ge nericRCPtr); const RCString* stringPtr = static_cast<const RCString*>(ge nericRCPtr);
return StringData(stringPtr->c_str(), stringPtr->size()); return StringData(stringPtr->c_str(), stringPtr->size());
skipping to change at line 193 skipping to change at line 196
void zero() { void zero() {
memset(this, 0, sizeof(*this)); memset(this, 0, sizeof(*this));
} }
// Byte-for-byte identical // Byte-for-byte identical
bool identical(const ValueStorage& other) const { bool identical(const ValueStorage& other) const {
return (i64[0] == other.i64[0] return (i64[0] == other.i64[0]
&& i64[1] == other.i64[1]); && i64[1] == other.i64[1]);
} }
void verifyRefCountingIfShould() const;
// This data is public because this should only be used by Value wh ich would be a friend // This data is public because this should only be used by Value wh ich would be a friend
union { union {
struct { struct {
// byte 1 // byte 1
signed char type; signed char type;
// byte 2 // byte 2
struct { struct {
bool refCounter : 1; // true if we need to refCount bool refCounter : 1; // true if we need to refCount
bool shortStr : 1; // true if we are using short string s bool shortStr : 1; // true if we are using short string s
 End of changes. 4 change blocks. 
0 lines changed or deleted 5 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/