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

Side by Side Diff: runtime/bin/vmstats_impl.cc

Issue 12328124: Removed remaining reference to FDUtils. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/vmstats_impl.h" 5 #include "bin/vmstats_impl.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "bin/fdutils.h"
10 #include "bin/file.h" 9 #include "bin/file.h"
11 #include "bin/log.h" 10 #include "bin/log.h"
12 #include "bin/platform.h" 11 #include "bin/platform.h"
13 #include "bin/socket.h" 12 #include "bin/socket.h"
14 #include "bin/thread.h" 13 #include "bin/thread.h"
15 #include "bin/utils.h" 14 #include "bin/utils.h"
16 #include "include/dart_debugger_api.h" 15 #include "include/dart_debugger_api.h"
17 #include "platform/json.h" 16 #include "platform/json.h"
18 17
19 #define BUFSIZE 8192 18 #define BUFSIZE 8192
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 dart::Monitor m; 141 dart::Monitor m;
143 MonitorLocker ml(&m); 142 MonitorLocker ml(&m);
144 ml.Wait(RETRY_PAUSE); 143 ml.Wait(RETRY_PAUSE);
145 144
146 continue; 145 continue;
147 } 146 }
148 if (socket < 0) { 147 if (socket < 0) {
149 // Stop() closed the socket. 148 // Stop() closed the socket.
150 return; 149 return;
151 } 150 }
152 FDUtils::SetBlocking(socket);
153 151
154 // TODO(tball): rewrite this to use STL, so as to eliminate the static 152 // TODO(tball): rewrite this to use STL, so as to eliminate the static
155 // buffer and support resource URLs that are longer than BUFSIZE. 153 // buffer and support resource URLs that are longer than BUFSIZE.
156 154
157 // Read request. 155 // Read request.
158 // TODO(tball): support partial reads, possibly needed for POST uploads.
159 char buffer[BUFSIZE + 1]; 156 char buffer[BUFSIZE + 1];
160 intptr_t len = Socket::Read(socket, buffer, BUFSIZE); 157 intptr_t len = Socket::Read(socket, buffer, BUFSIZE);
161 if (len <= 0) { 158 if (len <= 0) {
162 // Invalid HTTP request, ignore. 159 // Invalid HTTP request, ignore.
163 continue; 160 continue;
164 } 161 }
162 intptr_t n;
163 while ((n = Socket::Read(socket, buffer + len, BUFSIZE - len)) > 0) {
164 len += n;
165 }
165 buffer[len] = '\0'; 166 buffer[len] = '\0';
166 167
167 // Verify it's a GET request. 168 // Verify it's a GET request.
168 // TODO(tball): support POST requests. 169 // TODO(tball): support POST requests.
169 if (strncmp("GET ", buffer, 4) != 0 && strncmp("get ", buffer, 4) != 0) { 170 if (strncmp("GET ", buffer, 4) != 0 && strncmp("get ", buffer, 4) != 0) {
170 Log::PrintErr("Unsupported HTTP request type"); 171 Log::PrintErr("Unsupported HTTP request type");
171 const char* response = "HTTP/1.1 403 Forbidden\n" 172 const char* response = "HTTP/1.1 403 Forbidden\n"
172 "Content-Length: 120\n" 173 "Content-Length: 120\n"
173 "Connection: close\n" 174 "Connection: close\n"
174 "Content-Type: text/html\n\n" 175 "Content-Type: text/html\n\n"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 VmStatusPlugin* plugin = instance_->registered_plugin_list_; 324 VmStatusPlugin* plugin = instance_->registered_plugin_list_;
324 while (plugin != NULL) { 325 while (plugin != NULL) {
325 char* result = (plugin->callback())(request); 326 char* result = (plugin->callback())(request);
326 if (result != NULL) { 327 if (result != NULL) {
327 return result; 328 return result;
328 } 329 }
329 plugin = plugin->next(); 330 plugin = plugin->next();
330 } 331 }
331 return NULL; 332 return NULL;
332 } 333 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698