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

Side by Side Diff: chrome/browser/password_manager/keyring_proxy/message_reader.cc

Issue 8509038: Linux: split GNOME Keyring integration into a separate process. Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: merge Created 8 years, 11 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/password_manager/keyring_proxy/message_reader.h"
6
7 // This library is part of a very small helper binary that runs without any
8 // dependencies on base. Thus we can't use normal logging; we use assert.
9 #include <assert.h>
10
11 namespace keyring_proxy {
12
13 size_t MessageReader::HandleData(const char* data, size_t size) {
14 assert(!is_complete_);
15 size_t used = 0;
16 while (used < size) {
17 size_t end;
18 for (end = used; end < size && data[end] != '\n'; ++end) {}
19 lines_.back().append(&data[used], end - used);
20 if (end < size) {
21 // We found a newline. Skip past it and figure out what to do.
22 used = end + 1;
23 if (lines_.back().size() > 0) {
24 // The previous line was not empty. Start a new one.
25 lines_.resize(lines_.size() + 1);
26 } else {
27 // If the previous line was empty, this message is complete.
28 lines_.resize(lines_.size() - 1);
29 is_complete_ = true;
30 break;
31 }
32 } else {
33 // There was no newline, just the end of the input. Skip to the end.
34 used = end;
35 }
36 }
37 return used;
38 }
39
40 } // namespace keyring_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698