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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/keyring_proxy/message_reader.cc
===================================================================
--- chrome/browser/password_manager/keyring_proxy/message_reader.cc (revision 0)
+++ chrome/browser/password_manager/keyring_proxy/message_reader.cc (revision 0)
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/password_manager/keyring_proxy/message_reader.h"
+
+// This library is part of a very small helper binary that runs without any
+// dependencies on base. Thus we can't use normal logging; we use assert.
+#include <assert.h>
+
+namespace keyring_proxy {
+
+size_t MessageReader::HandleData(const char* data, size_t size) {
+ assert(!is_complete_);
+ size_t used = 0;
+ while (used < size) {
+ size_t end;
+ for (end = used; end < size && data[end] != '\n'; ++end) {}
+ lines_.back().append(&data[used], end - used);
+ if (end < size) {
+ // We found a newline. Skip past it and figure out what to do.
+ used = end + 1;
+ if (lines_.back().size() > 0) {
+ // The previous line was not empty. Start a new one.
+ lines_.resize(lines_.size() + 1);
+ } else {
+ // If the previous line was empty, this message is complete.
+ lines_.resize(lines_.size() - 1);
+ is_complete_ = true;
+ break;
+ }
+ } else {
+ // There was no newline, just the end of the input. Skip to the end.
+ used = end;
+ }
+ }
+ return used;
+}
+
+} // namespace keyring_proxy
Property changes on: chrome/browser/password_manager/keyring_proxy/message_reader.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698