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

Side by Side Diff: extensions/browser/api/cast_channel/cast_framer.h

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
11 #include <string> 12 #include <string>
12 13
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "extensions/common/api/cast_channel.h" 15 #include "extensions/common/api/cast_channel.h"
16 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
17 17
18 namespace extensions { 18 namespace extensions {
19 namespace api { 19 namespace api {
20 namespace cast_channel { 20 namespace cast_channel {
21 class CastMessage; 21 class CastMessage;
22 22
23 // Class for constructing and parsing CastMessage packet data. 23 // Class for constructing and parsing CastMessage packet data.
24 class MessageFramer { 24 class MessageFramer {
(...skipping 17 matching lines...) Expand all
42 // is fully read. 42 // is fully read.
43 // 43 //
44 // |num_bytes| The number of bytes received by a read operation. 44 // |num_bytes| The number of bytes received by a read operation.
45 // Value must be <= BytesRequested(). 45 // Value must be <= BytesRequested().
46 // |message_length| Size of the deserialized message object, in bytes. For 46 // |message_length| Size of the deserialized message object, in bytes. For
47 // logging purposes. Set to zero if no message was parsed. 47 // logging purposes. Set to zero if no message was parsed.
48 // |error| The result of the ingest operation. Set to CHANNEL_ERROR_NONE 48 // |error| The result of the ingest operation. Set to CHANNEL_ERROR_NONE
49 // if no error occurred. 49 // if no error occurred.
50 // Returns A pointer to a parsed CastMessage if a message was received 50 // Returns A pointer to a parsed CastMessage if a message was received
51 // in its entirety, nullptr otherwise. 51 // in its entirety, nullptr otherwise.
52 scoped_ptr<CastMessage> Ingest(size_t num_bytes, 52 std::unique_ptr<CastMessage> Ingest(size_t num_bytes,
53 size_t* message_length, 53 size_t* message_length,
54 ChannelError* error); 54 ChannelError* error);
55 55
56 // Message header struct. If fields are added, be sure to update 56 // Message header struct. If fields are added, be sure to update
57 // header_size(). Public to allow use of *_size() methods in unit tests. 57 // header_size(). Public to allow use of *_size() methods in unit tests.
58 struct MessageHeader { 58 struct MessageHeader {
59 MessageHeader(); 59 MessageHeader();
60 // Sets the message size. 60 // Sets the message size.
61 void SetMessageSize(size_t message_size); 61 void SetMessageSize(size_t message_size);
62 // Prepends this header to |str|. 62 // Prepends this header to |str|.
63 void PrependToString(std::string* str); 63 void PrependToString(std::string* str);
64 // Reads |header| from the bytes specified by |data|. 64 // Reads |header| from the bytes specified by |data|.
(...skipping 29 matching lines...) Expand all
94 94
95 // Disables Ingest functionality is the parser receives invalid data. 95 // Disables Ingest functionality is the parser receives invalid data.
96 bool error_; 96 bool error_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(MessageFramer); 98 DISALLOW_COPY_AND_ASSIGN(MessageFramer);
99 }; 99 };
100 } // namespace cast_channel 100 } // namespace cast_channel
101 } // namespace api 101 } // namespace api
102 } // namespace extensions 102 } // namespace extensions
103 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ 103 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_channel_apitest.cc ('k') | extensions/browser/api/cast_channel/cast_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698