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

Side by Side Diff: src/top.cc

Issue 1940: Replaced calls to functions that msvc consider deprecated. Used... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/string-stream.cc ('k') | src/utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 class PreallocatedMemoryThread: public Thread { 117 class PreallocatedMemoryThread: public Thread {
118 public: 118 public:
119 PreallocatedMemoryThread() : keep_running_(true) { 119 PreallocatedMemoryThread() : keep_running_(true) {
120 wait_for_ever_semaphore_ = OS::CreateSemaphore(0); 120 wait_for_ever_semaphore_ = OS::CreateSemaphore(0);
121 data_ready_semaphore_ = OS::CreateSemaphore(0); 121 data_ready_semaphore_ = OS::CreateSemaphore(0);
122 } 122 }
123 123
124 // When the thread starts running it will allocate a fixed number of bytes 124 // When the thread starts running it will allocate a fixed number of bytes
125 // on the stack and publish the location of this memory for others to use. 125 // on the stack and publish the location of this memory for others to use.
126 void Run() { 126 void Run() {
127 char local_buffer[16 * 1024]; 127 EmbeddedVector<char, 16 * 1024> local_buffer;
128 128
129 // Initialize the buffer with a known good value. 129 // Initialize the buffer with a known good value.
130 strncpy(local_buffer, "Trace data was not generated.\n", 130 OS::StrNCpy(local_buffer, "Trace data was not generated.\n",
131 sizeof(local_buffer)); 131 local_buffer.length());
132 132
133 // Publish the local buffer and signal its availability. 133 // Publish the local buffer and signal its availability.
134 data_ = &local_buffer[0]; 134 data_ = &local_buffer[0];
135 length_ = sizeof(local_buffer); 135 length_ = sizeof(local_buffer);
136 data_ready_semaphore_->Signal(); 136 data_ready_semaphore_->Signal();
137 137
138 while (keep_running_) { 138 while (keep_running_) {
139 // This thread will wait here until the end of time. 139 // This thread will wait here until the end of time.
140 wait_for_ever_semaphore_->Wait(); 140 wait_for_ever_semaphore_->Wait();
141 } 141 }
142 142
143 // Make sure we access the buffer after the wait to remove all possibility 143 // Make sure we access the buffer after the wait to remove all possibility
144 // of it being optimized away. 144 // of it being optimized away.
145 strncpy(local_buffer, "PreallocatedMemoryThread shutting down.\n", 145 OS::StrNCpy(local_buffer, "PreallocatedMemoryThread shutting down.\n",
146 sizeof(local_buffer)); 146 local_buffer.length());
147 } 147 }
148 148
149 static char* data() { 149 static char* data() {
150 if (data_ready_semaphore_ != NULL) { 150 if (data_ready_semaphore_ != NULL) {
151 // Initial access is guarded until the data has been published. 151 // Initial access is guarded until the data has been published.
152 data_ready_semaphore_->Wait(); 152 data_ready_semaphore_->Wait();
153 delete data_ready_semaphore_; 153 delete data_ready_semaphore_;
154 data_ready_semaphore_ = NULL; 154 data_ready_semaphore_ = NULL;
155 } 155 }
156 return data_; 156 return data_;
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 Top::break_access_->Lock(); 889 Top::break_access_->Lock();
890 } 890 }
891 891
892 892
893 ExecutionAccess::~ExecutionAccess() { 893 ExecutionAccess::~ExecutionAccess() {
894 Top::break_access_->Unlock(); 894 Top::break_access_->Unlock();
895 } 895 }
896 896
897 897
898 } } // namespace v8::internal 898 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/string-stream.cc ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698