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

Side by Side Diff: components/tracing/core/proto_utils.cc

Issue 2308583003: tracing v2: Introduce TraceBufferReader to read-back the trace buffer (Closed)
Patch Set: DISALLOW_COPY_AND_ASSIGN + cctype for isalnum 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/tracing/core/proto_utils.h" 5 #include "components/tracing/core/proto_utils.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/sys_byteorder.h" 9 #include "base/sys_byteorder.h"
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 *field_intvalue = base::ByteSwapToLE32(tmp); 67 *field_intvalue = base::ByteSwapToLE32(tmp);
68 pos += sizeof(uint32_t); 68 pos += sizeof(uint32_t);
69 break; 69 break;
70 } 70 }
71 case kFieldTypeVarInt: { 71 case kFieldTypeVarInt: {
72 pos = ParseVarInt(pos, end, field_intvalue); 72 pos = ParseVarInt(pos, end, field_intvalue);
73 break; 73 break;
74 } 74 }
75 case kFieldTypeLengthDelimited: { 75 case kFieldTypeLengthDelimited: {
76 pos = ParseVarInt(pos, end, field_intvalue); 76 pos = ParseVarInt(pos, end, field_intvalue);
77 CHECK_LE(*field_intvalue, kMaxMessageLength);
77 pos += *field_intvalue; 78 pos += *field_intvalue;
78 CHECK_PTR_LE(pos, end); 79 CHECK_PTR_LE(pos, end);
79 break; 80 break;
80 } 81 }
81 default: 82 default:
82 NOTREACHED() << "Unsupported proto field type " << *field_type; 83 NOTREACHED() << "Unsupported proto field type " << *field_type;
83 } 84 }
84 return pos; 85 return pos;
85 } 86 }
86 87
87 } // namespace proto 88 } // namespace proto
88 } // namespace v2 89 } // namespace v2
89 } // namespace tracing 90 } // namespace tracing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698