summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-11-02 12:48:08 +0000
committerIain Merrick <husky@google.com>2010-11-03 15:54:43 +0000
commit2d2498eb555b4096a63a64dc6afcf2c95ec19f4d (patch)
treef4f67e4b3b93a2b1f78729b18e6f0fd289fb591f
parenta63d6587a9fe4317d9cd57ab8b7ef9e5951d05fc (diff)
downloadexternal_chromium-2d2498eb555b4096a63a64dc6afcf2c95ec19f4d.zip
external_chromium-2d2498eb555b4096a63a64dc6afcf2c95ec19f4d.tar.gz
external_chromium-2d2498eb555b4096a63a64dc6afcf2c95ec19f4d.tar.bz2
Merge Chromium at r63472 : Workaround for compiler bug.
IN PROGRESS. The compiler generates bad assembly for this file and I don't know why. There's something it doesn't like about this one function; splitting it out into a separate file fixes the problem. Change-Id: I3cad52d7a14d341d16b826c031fd3b2599197b74
-rw-r--r--Android.mk1
-rw-r--r--android/net/spdy/spdy_session_android.cc147
-rw-r--r--net/spdy/spdy_session.cc6
3 files changed, 154 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
index 67af29c..26ab42a 100644
--- a/Android.mk
+++ b/Android.mk
@@ -61,6 +61,7 @@ LOCAL_SRC_FILES := \
android/app/l10n_util.cc \
android/jni/mime_utils.cc \
android/jni/jni_utils.cc \
+ android/net/spdy/spdy_session_android.cc \
\
app/sql/connection.cc \
app/sql/meta_table.cc \
diff --git a/android/net/spdy/spdy_session_android.cc b/android/net/spdy/spdy_session_android.cc
new file mode 100644
index 0000000..0887d5c
--- /dev/null
+++ b/android/net/spdy/spdy_session_android.cc
@@ -0,0 +1,147 @@
+// Copyright (c) 2010 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 "net/spdy/spdy_session.h"
+
+#include "base/basictypes.h"
+#include "base/linked_ptr.h"
+#include "base/logging.h"
+#include "base/message_loop.h"
+#include "base/metrics/stats_counters.h"
+#include "base/stl_util-inl.h"
+#include "base/string_number_conversions.h"
+#include "base/string_util.h"
+#include "base/stringprintf.h"
+#include "base/time.h"
+#include "base/utf_string_conversions.h"
+#include "base/values.h"
+#include "net/base/connection_type_histograms.h"
+#include "net/base/net_log.h"
+#include "net/base/net_util.h"
+#include "net/http/http_network_session.h"
+#include "net/socket/ssl_client_socket.h"
+#include "net/spdy/spdy_frame_builder.h"
+#include "net/spdy/spdy_protocol.h"
+#include "net/spdy/spdy_settings_storage.h"
+#include "net/spdy/spdy_stream.h"
+
+namespace net {
+
+namespace {
+
+class NetLogSpdySynParameter : public NetLog::EventParameters {
+ public:
+ NetLogSpdySynParameter(const linked_ptr<spdy::SpdyHeaderBlock>& headers,
+ spdy::SpdyControlFlags flags,
+ spdy::SpdyStreamId id)
+ : headers_(headers), flags_(flags), id_(id) {}
+
+ Value* ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ ListValue* headers_list = new ListValue();
+ for (spdy::SpdyHeaderBlock::const_iterator it = headers_->begin();
+ it != headers_->end(); ++it) {
+ headers_list->Append(new StringValue(base::StringPrintf(
+ "%s: %s", it->first.c_str(), it->second.c_str())));
+ }
+ dict->SetInteger("flags", flags_);
+ dict->Set("headers", headers_list);
+ dict->SetInteger("id", id_);
+ return dict;
+ }
+
+ private:
+ ~NetLogSpdySynParameter() {}
+
+ const linked_ptr<spdy::SpdyHeaderBlock> headers_;
+ const spdy::SpdyControlFlags flags_;
+ const spdy::SpdyStreamId id_;
+
+ DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter);
+};
+
+}
+
+void SpdySession::OnSyn(const spdy::SpdySynStreamControlFrame& frame,
+ const linked_ptr<spdy::SpdyHeaderBlock>& headers) {
+ spdy::SpdyStreamId stream_id = frame.stream_id();
+ spdy::SpdyStreamId associated_stream_id = frame.associated_stream_id();
+
+ if (net_log_.IsLoggingAllEvents()) {
+ net_log_.AddEvent(
+ NetLog::TYPE_SPDY_SESSION_PUSHED_SYN_STREAM,
+ new NetLogSpdySynParameter(
+ headers, static_cast<spdy::SpdyControlFlags>(frame.flags()),
+ stream_id));
+ }
+
+ // Server-initiated streams should have even sequence numbers.
+ if ((stream_id & 0x1) != 0) {
+ LOG(ERROR) << "Received invalid OnSyn stream id " << stream_id;
+ return;
+ }
+
+ if (IsStreamActive(stream_id)) {
+ LOG(ERROR) << "Received OnSyn for active stream " << stream_id;
+ return;
+ }
+
+ if (associated_stream_id == 0) {
+ LOG(ERROR) << "Received invalid OnSyn associated stream id "
+ << associated_stream_id
+ << " for stream " << stream_id;
+ ResetStream(stream_id, spdy::INVALID_STREAM);
+ return;
+ }
+
+ streams_pushed_count_++;
+
+ // TODO(mbelshe): DCHECK that this is a GET method?
+
+ const std::string& path = ContainsKey(*headers, "path") ?
+ headers->find("path")->second : "";
+
+ // Verify that the response had a URL for us.
+ if (path.empty()) {
+ ResetStream(stream_id, spdy::PROTOCOL_ERROR);
+ LOG(WARNING) << "Pushed stream did not contain a path.";
+ return;
+ }
+
+ if (!IsStreamActive(associated_stream_id)) {
+ LOG(ERROR) << "Received OnSyn with inactive associated stream "
+ << associated_stream_id;
+ ResetStream(stream_id, spdy::INVALID_ASSOCIATED_STREAM);
+ return;
+ }
+
+ // TODO(erikchen): Actually do something with the associated id.
+
+ // There should not be an existing pushed stream with the same path.
+ PushedStreamMap::iterator it = unclaimed_pushed_streams_.find(path);
+ if (it != unclaimed_pushed_streams_.end()) {
+ LOG(ERROR) << "Received duplicate pushed stream with path: " << path;
+ ResetStream(stream_id, spdy::PROTOCOL_ERROR);
+ return;
+ }
+
+ scoped_refptr<SpdyStream> stream =
+ new SpdyStream(this, stream_id, true, net_log_);
+
+ stream->set_path(path);
+
+ unclaimed_pushed_streams_[path] = stream;
+
+ ActivateStream(stream);
+ stream->set_response_received();
+
+ // Parse the headers.
+ if (!Respond(*headers, stream))
+ return;
+
+ static base::StatsCounter push_requests("spdy.pushed_streams");
+ push_requests.Increment();
+}
+
+} // namespace net
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index f94dfd3..b89665e 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -988,6 +988,10 @@ bool SpdySession::Respond(const spdy::SpdyHeaderBlock& headers,
return true;
}
+#if !defined(ANDROID)
+// This function generates bad ARM assembly in the Android build.
+// As a workaround, it has been moved to android/net/spdy/spdy_session_android.cc
+
void SpdySession::OnSyn(const spdy::SpdySynStreamControlFrame& frame,
const linked_ptr<spdy::SpdyHeaderBlock>& headers) {
spdy::SpdyStreamId stream_id = frame.stream_id();
@@ -1069,6 +1073,8 @@ void SpdySession::OnSyn(const spdy::SpdySynStreamControlFrame& frame,
push_requests.Increment();
}
+#endif // ANDROID
+
void SpdySession::OnSynReply(const spdy::SpdySynReplyControlFrame& frame,
const linked_ptr<spdy::SpdyHeaderBlock>& headers) {
spdy::SpdyStreamId stream_id = frame.stream_id();