Skip to content

Commit

Permalink
Create a separate NetLog source type QUIC_STREAM_FACTORY_JOB
Browse files Browse the repository at this point in the history
for each QuicStreamFactory::Job created.

BUG=702411

Review-Url: https://codereview.chromium.org/2800023002
Cr-Commit-Position: refs/heads/master@{#463023}
  • Loading branch information
zyshi authored and Commit bot committed Apr 7, 2017
1 parent 4573933 commit 96b7a82
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
30 changes: 30 additions & 0 deletions net/log/net_log_event_type_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,15 @@ EVENT_TYPE(HTTP_STREAM_JOB_INIT_CONNECTION)
// }
EVENT_TYPE(HTTP_STREAM_REQUEST_BOUND_TO_JOB)

// Identifies the NetLogSource() for the QuicStreamFactory::Job that the
// HttpStreamFactoryImpl::Job was attached to.
// The event parameters are:
// {
// "source_dependency": <Source identifier for the QuicStreamFactory::Job
// to which we were attached>,
// }
EVENT_TYPE(HTTP_STREAM_JOB_BOUND_TO_QUIC_STREAM_FACTORY_JOB)

// Identifies the NetLogSource() for the Request that the Job was attached to.
// The event parameters are:
// {
Expand Down Expand Up @@ -1631,6 +1640,27 @@ EVENT_TYPE(HTTP2_PROXY_CLIENT_SESSION)
// "source_dependency": <Source identifier for the underlying session>,
// }

// ------------------------------------------------------------------------
// QuicStreamFactory::Job
// ------------------------------------------------------------------------

// Measures the time taken to execute the QuicStreamFactory::Job.
// The event parameters are:
// {
// "server_id": <The QuicServerId that the Job serves>,
// }
EVENT_TYPE(QUIC_STREAM_FACTORY_JOB)

// Identifies the NetLogSource() for the HttpStreamFactoryImpl::Job that the
// Job was attached to.
// The event parameters are:
// {
// "source_dependency": <Source identifier for the
// HttpStreamFactoryImpl::Job to which we were
// attached>,
// }
EVENT_TYPE(QUIC_STREAM_FACTORY_JOB_BOUND_TO_HTTP_STREAM_JOB)

// ------------------------------------------------------------------------
// QuicSession
// ------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions net/log/net_log_source_type_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ SOURCE_TYPE(NETWORK_QUALITY_ESTIMATOR)
SOURCE_TYPE(HTTP_STREAM_JOB_CONTROLLER)
SOURCE_TYPE(CT_TREE_STATE_TRACKER)
SOURCE_TYPE(SERVER_PUSH_LOOKUP_TRANSACTION)
SOURCE_TYPE(QUIC_STREAM_FACTORY_JOB)
26 changes: 24 additions & 2 deletions net/quic/chromium/quic_stream_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ const int32_t kQuicStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB
// Set the maximum number of undecryptable packets the connection will store.
const int32_t kMaxUndecryptablePackets = 100;

std::unique_ptr<base::Value> NetLogQuicStreamFactoryJobCallback(
const QuicServerId* server_id,
NetLogCaptureMode capture_mode) {
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("server_id", server_id->ToString());
return std::move(dict);
}

std::unique_ptr<base::Value> NetLogQuicConnectionMigrationTriggerCallback(
std::string trigger,
NetLogCaptureMode capture_mode) {
Expand Down Expand Up @@ -386,12 +394,26 @@ QuicStreamFactory::Job::Job(QuicStreamFactory* factory,
was_alternative_service_recently_broken),
server_info_(std::move(server_info)),
started_another_job_(false),
net_log_(net_log),
net_log_(
NetLogWithSource::Make(net_log.net_log(),
NetLogSourceType::QUIC_STREAM_FACTORY_JOB)),
num_sent_client_hellos_(0),
session_(nullptr),
weak_factory_(this) {}
weak_factory_(this) {
net_log_.BeginEvent(
NetLogEventType::QUIC_STREAM_FACTORY_JOB,
base::Bind(&NetLogQuicStreamFactoryJobCallback, &key_.server_id()));
// Associate |net_log_| with |net_log|.
net_log_.AddEvent(
NetLogEventType::QUIC_STREAM_FACTORY_JOB_BOUND_TO_HTTP_STREAM_JOB,
net_log.source().ToEventParametersCallback());
net_log.AddEvent(
NetLogEventType::HTTP_STREAM_JOB_BOUND_TO_QUIC_STREAM_FACTORY_JOB,
net_log_.source().ToEventParametersCallback());
}

QuicStreamFactory::Job::~Job() {
net_log_.EndEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB);
DCHECK(callback_.is_null());

// If disk cache has a pending WaitForDataReadyCallback, cancel that callback.
Expand Down

0 comments on commit 96b7a82

Please sign in to comment.