OLD | NEW |
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 "net/spdy/spdy_stream.h" | 5 #include "net/spdy/spdy_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "net/spdy/spdy_buffer_producer.h" | 15 #include "net/spdy/spdy_buffer_producer.h" |
16 #include "net/spdy/spdy_http_utils.h" | 16 #include "net/spdy/spdy_http_utils.h" |
17 #include "net/spdy/spdy_session.h" | 17 #include "net/spdy/spdy_session.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 base::Value* NetLogSpdyStreamErrorCallback( | 23 scoped_ptr<base::Value> NetLogSpdyStreamErrorCallback( |
24 SpdyStreamId stream_id, | 24 SpdyStreamId stream_id, |
25 int status, | 25 int status, |
26 const std::string* description, | 26 const std::string* description, |
27 NetLogCaptureMode /* capture_mode */) { | 27 NetLogCaptureMode /* capture_mode */) { |
28 base::DictionaryValue* dict = new base::DictionaryValue(); | 28 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
29 dict->SetInteger("stream_id", static_cast<int>(stream_id)); | 29 dict->SetInteger("stream_id", static_cast<int>(stream_id)); |
30 dict->SetInteger("status", status); | 30 dict->SetInteger("status", status); |
31 dict->SetString("description", *description); | 31 dict->SetString("description", *description); |
32 return dict; | 32 return dict.Pass(); |
33 } | 33 } |
34 | 34 |
35 base::Value* NetLogSpdyStreamWindowUpdateCallback( | 35 scoped_ptr<base::Value> NetLogSpdyStreamWindowUpdateCallback( |
36 SpdyStreamId stream_id, | 36 SpdyStreamId stream_id, |
37 int32 delta, | 37 int32 delta, |
38 int32 window_size, | 38 int32 window_size, |
39 NetLogCaptureMode /* capture_mode */) { | 39 NetLogCaptureMode /* capture_mode */) { |
40 base::DictionaryValue* dict = new base::DictionaryValue(); | 40 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
41 dict->SetInteger("stream_id", stream_id); | 41 dict->SetInteger("stream_id", stream_id); |
42 dict->SetInteger("delta", delta); | 42 dict->SetInteger("delta", delta); |
43 dict->SetInteger("window_size", window_size); | 43 dict->SetInteger("window_size", window_size); |
44 return dict; | 44 return dict.Pass(); |
45 } | 45 } |
46 | 46 |
47 bool ContainsUppercaseAscii(const std::string& str) { | 47 bool ContainsUppercaseAscii(const std::string& str) { |
48 for (std::string::const_iterator i(str.begin()); i != str.end(); ++i) { | 48 for (std::string::const_iterator i(str.begin()); i != str.end(); ++i) { |
49 if (*i >= 'A' && *i <= 'Z') { | 49 if (*i >= 'A' && *i <= 'Z') { |
50 return true; | 50 return true; |
51 } | 51 } |
52 } | 52 } |
53 return false; | 53 return false; |
54 } | 54 } |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 924 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
925 state); | 925 state); |
926 break; | 926 break; |
927 } | 927 } |
928 return description; | 928 return description; |
929 } | 929 } |
930 | 930 |
931 #undef STATE_CASE | 931 #undef STATE_CASE |
932 | 932 |
933 } // namespace net | 933 } // namespace net |
OLD | NEW |