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

Side by Side Diff: chrome/renderer/loadtimes_extension_bindings.cc

Issue 2347163002: s/NPN/ALPN/ (Closed)
Patch Set: Re: #12. Created 4 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
« no previous file with comments | « no previous file | components/cronet/android/cronet_url_request_adapter.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/loadtimes_extension_bindings.h" 5 #include "chrome/renderer/loadtimes_extension_bindings.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/public/renderer/document_state.h" 10 #include "content/public/renderer/document_state.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 double finish_load_time = web_performance.loadEventEnd(); 161 double finish_load_time = web_performance.loadEventEnd();
162 double first_paint_time = web_performance.firstPaint(); 162 double first_paint_time = web_performance.firstPaint();
163 // TODO(bmcquade): remove this. It's misleading to track the first paint 163 // TODO(bmcquade): remove this. It's misleading to track the first paint
164 // after the load event, since many pages perform their meaningful paints 164 // after the load event, since many pages perform their meaningful paints
165 // long before the load event fires. We report a time of zero for the 165 // long before the load event fires. We report a time of zero for the
166 // time being. 166 // time being.
167 double first_paint_after_load_time = 0.0; 167 double first_paint_after_load_time = 0.0;
168 std::string navigation_type = 168 std::string navigation_type =
169 GetNavigationType(data_source->navigationType()); 169 GetNavigationType(data_source->navigationType());
170 bool was_fetched_via_spdy = document_state->was_fetched_via_spdy(); 170 bool was_fetched_via_spdy = document_state->was_fetched_via_spdy();
171 bool was_npn_negotiated = document_state->was_npn_negotiated(); 171 bool was_alpn_negotiated = document_state->was_alpn_negotiated();
172 std::string npn_negotiated_protocol = 172 std::string alpn_negotiated_protocol =
173 document_state->npn_negotiated_protocol(); 173 document_state->alpn_negotiated_protocol();
174 bool was_alternate_protocol_available = 174 bool was_alternate_protocol_available =
175 document_state->was_alternate_protocol_available(); 175 document_state->was_alternate_protocol_available();
176 std::string connection_info = net::HttpResponseInfo::ConnectionInfoToString( 176 std::string connection_info = net::HttpResponseInfo::ConnectionInfoToString(
177 document_state->connection_info()); 177 document_state->connection_info());
178 178
179 // Important: |frame|, |data_source| and |document_state| should not be 179 // Important: |frame|, |data_source| and |document_state| should not be
180 // referred to below this line, as JS setters below can invalidate these 180 // referred to below this line, as JS setters below can invalidate these
181 // pointers. 181 // pointers.
182 v8::Isolate* isolate = args.GetIsolate(); 182 v8::Isolate* isolate = args.GetIsolate();
183 v8::Local<v8::Context> ctx = isolate->GetCurrentContext(); 183 v8::Local<v8::Context> ctx = isolate->GetCurrentContext();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 ctx, 277 ctx,
278 v8::String::NewFromUtf8( 278 v8::String::NewFromUtf8(
279 isolate, "wasFetchedViaSpdy", v8::NewStringType::kNormal) 279 isolate, "wasFetchedViaSpdy", v8::NewStringType::kNormal)
280 .ToLocalChecked(), 280 .ToLocalChecked(),
281 LoadtimesGetter, 281 LoadtimesGetter,
282 nullptr, 282 nullptr,
283 v8::Boolean::New(isolate, was_fetched_via_spdy)) 283 v8::Boolean::New(isolate, was_fetched_via_spdy))
284 .FromMaybe(false)) { 284 .FromMaybe(false)) {
285 return; 285 return;
286 } 286 }
287 if (!load_times->SetAccessor( 287 if (!load_times
288 ctx, 288 ->SetAccessor(ctx,
289 v8::String::NewFromUtf8( 289 v8::String::NewFromUtf8(isolate, "wasNpnNegotiated",
290 isolate, "wasNpnNegotiated", v8::NewStringType::kNormal) 290 v8::NewStringType::kNormal)
291 .ToLocalChecked(), 291 .ToLocalChecked(),
292 LoadtimesGetter, 292 LoadtimesGetter, nullptr,
293 nullptr, 293 v8::Boolean::New(isolate, was_alpn_negotiated))
294 v8::Boolean::New(isolate, was_npn_negotiated)) 294 .FromMaybe(false)) {
295 .FromMaybe(false)) { 295 return;
296 }
297 if (!load_times
298 ->SetAccessor(
299 ctx, v8::String::NewFromUtf8(isolate, "npnNegotiatedProtocol",
300 v8::NewStringType::kNormal)
301 .ToLocalChecked(),
302 LoadtimesGetter, nullptr,
303 v8::String::NewFromUtf8(isolate,
304 alpn_negotiated_protocol.c_str(),
305 v8::NewStringType::kNormal)
306 .ToLocalChecked())
307 .FromMaybe(false)) {
296 return; 308 return;
297 } 309 }
298 if (!load_times->SetAccessor( 310 if (!load_times->SetAccessor(
299 ctx,
300 v8::String::NewFromUtf8(
301 isolate, "npnNegotiatedProtocol", v8::NewStringType::kNormal)
302 .ToLocalChecked(),
303 LoadtimesGetter,
304 nullptr,
305 v8::String::NewFromUtf8(isolate, npn_negotiated_protocol.c_str(),
306 v8::NewStringType::kNormal)
307 .ToLocalChecked())
308 .FromMaybe(false)) {
309 return;
310 }
311 if (!load_times->SetAccessor(
312 ctx, 311 ctx,
313 v8::String::NewFromUtf8( 312 v8::String::NewFromUtf8(
314 isolate, "wasAlternateProtocolAvailable", 313 isolate, "wasAlternateProtocolAvailable",
315 v8::NewStringType::kNormal) 314 v8::NewStringType::kNormal)
316 .ToLocalChecked(), 315 .ToLocalChecked(),
317 LoadtimesGetter, 316 LoadtimesGetter,
318 nullptr, 317 nullptr,
319 v8::Boolean::New(isolate, was_alternate_protocol_available)) 318 v8::Boolean::New(isolate, was_alternate_protocol_available))
320 .FromMaybe(false)) { 319 .FromMaybe(false)) {
321 return; 320 return;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 393 }
395 args.GetReturnValue().Set(csi); 394 args.GetReturnValue().Set(csi);
396 } 395 }
397 }; 396 };
398 397
399 v8::Extension* LoadTimesExtension::Get() { 398 v8::Extension* LoadTimesExtension::Get() {
400 return new LoadTimesExtensionWrapper(); 399 return new LoadTimesExtensionWrapper();
401 } 400 }
402 401
403 } // namespace extensions_v8 402 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « no previous file | components/cronet/android/cronet_url_request_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698