summaryrefslogtreecommitdiffstats
path: root/WebKit/android/WebCoreSupport/ChromiumInit.cpp
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-12-01 16:04:54 +0000
committerKristian Monsen <kristianm@google.com>2010-12-02 12:48:28 +0000
commitf1db1f116e53299d77f6458ca3bfa5f0b4a160cb (patch)
treef3c759186f84281dcbbee1324322ea58c2287dc1 /WebKit/android/WebCoreSupport/ChromiumInit.cpp
parent0dea64c9575802352241ad43b78e20198a6e137c (diff)
downloadexternal_webkit-f1db1f116e53299d77f6458ca3bfa5f0b4a160cb.zip
external_webkit-f1db1f116e53299d77f6458ca3bfa5f0b4a160cb.tar.gz
external_webkit-f1db1f116e53299d77f6458ca3bfa5f0b4a160cb.tar.bz2
Enable SPDY, and renames initChromiumLogging
initChromiumLogging is now renamed to the more generic initChromium, the files are renamed to ChromiumInit.* Change-Id: Ic9639d637f25e664b51d076b9b0ee58c2867c1b5
Diffstat (limited to 'WebKit/android/WebCoreSupport/ChromiumInit.cpp')
-rw-r--r--WebKit/android/WebCoreSupport/ChromiumInit.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/ChromiumInit.cpp b/WebKit/android/WebCoreSupport/ChromiumInit.cpp
new file mode 100644
index 0000000..221704b
--- /dev/null
+++ b/WebKit/android/WebCoreSupport/ChromiumInit.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ChromiumInit.h"
+
+#include "ChromiumIncludes.h"
+
+#include <cutils/log.h>
+#include <string>
+
+namespace android {
+
+bool logMessageHandler(int severity, const char* file, int line, size_t message_start, const std::string& str) {
+ int androidSeverity = ANDROID_LOG_VERBOSE;
+ switch(severity) {
+ case logging::LOG_FATAL:
+ androidSeverity = ANDROID_LOG_FATAL;
+ break;
+ case logging::LOG_ERROR_REPORT:
+ case logging::LOG_ERROR:
+ androidSeverity = ANDROID_LOG_ERROR;
+ break;
+ case logging::LOG_WARNING:
+ androidSeverity = ANDROID_LOG_WARN;
+ break;
+ default:
+ androidSeverity = ANDROID_LOG_VERBOSE;
+ break;
+ }
+ android_printLog(androidSeverity, "chromium", "%s:%d: %s", file, line, str.c_str());
+ return false;
+}
+
+void initChromium()
+{
+ static Lock lock;
+ AutoLock aLock(lock);
+ static bool initCalled = false;
+ if (!initCalled) {
+ logging::SetLogMessageHandler(logMessageHandler);
+ net::HttpNetworkLayer::EnableSpdy("npn");
+ initCalled = true;
+ }
+}
+
+} // namespace android