Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: mojo/public/environment/lib/buffer_tls.cc

Issue 148013006: Mojo: re-org public/utility and public/environment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lower similarity factor Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/environment/lib/DEPS ('k') | mojo/public/environment/lib/buffer_tls_setup.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/environment/lib/buffer_tls.cc
diff --git a/mojo/public/environment/standalone/buffer_tls.cc b/mojo/public/environment/lib/buffer_tls.cc
similarity index 52%
rename from mojo/public/environment/standalone/buffer_tls.cc
rename to mojo/public/environment/lib/buffer_tls.cc
index a26d30dcef007392f948f6088600c3645f953478..8c0793bc8fd77e661ea687fc09d388d712f695d0 100644
--- a/mojo/public/environment/standalone/buffer_tls.cc
+++ b/mojo/public/environment/lib/buffer_tls.cc
@@ -4,29 +4,32 @@
#include "mojo/public/environment/buffer_tls.h"
-#include "mojo/public/environment/standalone/buffer_tls_setup.h"
-#include "mojo/public/utility/thread_local.h"
+#include <assert.h>
+
+#include "mojo/public/environment/lib/buffer_tls_setup.h"
+#include "mojo/public/utility/lib/thread_local.h"
namespace mojo {
namespace internal {
-static ThreadLocalPlatform::SlotType s_slot;
+static ThreadLocalPointer<Buffer> current_buffer;
void SetUpCurrentBuffer() {
- ThreadLocalPlatform::AllocateSlot(&s_slot);
+ current_buffer.Allocate();
}
void TearDownCurrentBuffer() {
- ThreadLocalPlatform::FreeSlot(s_slot);
+ assert(!current_buffer.Get());
+ current_buffer.Free();
}
Buffer* GetCurrentBuffer() {
- return static_cast<Buffer*>(ThreadLocalPlatform::GetValueFromSlot(s_slot));
+ return current_buffer.Get();
}
Buffer* SetCurrentBuffer(Buffer* buf) {
- Buffer* old_buf = GetCurrentBuffer();
- ThreadLocalPlatform::SetValueInSlot(s_slot, buf);
+ Buffer* old_buf = current_buffer.Get();
+ current_buffer.Set(buf);
return old_buf;
}
« no previous file with comments | « mojo/public/environment/lib/DEPS ('k') | mojo/public/environment/lib/buffer_tls_setup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698