summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-15 21:20:06 +0000
committerdtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-15 21:20:06 +0000
commite99274704e1603e54a3d21fd4d87986984d55a58 (patch)
tree4d5a8b6aa7c4aa86bed7766c71bb9bd64275457d
parentb02d469b9e0f240e52ea453d13c43cf08ac52e23 (diff)
downloadchromium_src-e99274704e1603e54a3d21fd4d87986984d55a58.zip
chromium_src-e99274704e1603e54a3d21fd4d87986984d55a58.tar.gz
chromium_src-e99274704e1603e54a3d21fd4d87986984d55a58.tar.bz2
Move libxml_utils from chrome/common to third_party/libxml/chromium.
Why here? Discussion at: https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/fafe7c6bb54c4ed5/ BUG=chromium:119817 TEST=Chrome builds on all platforms and trybots succeed. Review URL: https://chromiumcodereview.appspot.com/10251004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137247 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/DEPS1
-rw-r--r--chrome/browser/chromeos/dbus/introspect_util.cc2
-rw-r--r--chrome/browser/chromeos/gdata/gdata_operations.cc2
-rw-r--r--chrome/browser/chromeos/gdata/gdata_parser.cc2
-rw-r--r--chrome/browser/chromeos/gdata/gdata_parser_unittest.cc2
-rw-r--r--chrome/browser/chromeos/gdata/gdata_util.cc2
-rw-r--r--chrome/browser/importer/toolbar_importer.cc2
-rw-r--r--chrome/browser/importer/toolbar_importer_unittest.cc4
-rw-r--r--chrome/chrome_common.gypi2
-rw-r--r--chrome/common/extensions/update_manifest.cc4
-rw-r--r--chrome/test/reliability/automated_ui_tests.cc1
-rw-r--r--chrome/test/reliability/automated_ui_tests.h3
-rw-r--r--third_party/libxml/README.chromium1
-rw-r--r--third_party/libxml/chromium/libxml_utils.cc (renamed from chrome/common/libxml_utils.cc)40
-rw-r--r--third_party/libxml/chromium/libxml_utils.h (renamed from chrome/common/libxml_utils.h)24
-rw-r--r--third_party/libxml/libxml.gyp14
16 files changed, 37 insertions, 69 deletions
diff --git a/chrome/DEPS b/chrome/DEPS
index 949cb3b..ccba66e 100644
--- a/chrome/DEPS
+++ b/chrome/DEPS
@@ -44,6 +44,7 @@ include_rules = [
# Allow inclusion of third-party code:
"+third_party/hunspell",
"+third_party/icon_family", # IconFamily for Mac.
+ "+third_party/libxml",
"+third_party/mozilla", # Mozilla interface headers.
"+third_party/npapi", # NPAPI interface headers.
"+third_party/skia",
diff --git a/chrome/browser/chromeos/dbus/introspect_util.cc b/chrome/browser/chromeos/dbus/introspect_util.cc
index 6b7dc5f..997fd7b 100644
--- a/chrome/browser/chromeos/dbus/introspect_util.cc
+++ b/chrome/browser/chromeos/dbus/introspect_util.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/chromeos/dbus/introspect_util.h"
-#include "chrome/common/libxml_utils.h"
+#include "third_party/libxml/chromium/libxml_utils.h"
namespace {
diff --git a/chrome/browser/chromeos/gdata/gdata_operations.cc b/chrome/browser/chromeos/gdata/gdata_operations.cc
index ad6df46..2217dd7 100644
--- a/chrome/browser/chromeos/gdata/gdata_operations.cc
+++ b/chrome/browser/chromeos/gdata/gdata_operations.cc
@@ -12,12 +12,12 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/gdata/gdata_file_system.h"
#include "chrome/browser/chromeos/gdata/gdata_util.h"
-#include "chrome/common/libxml_utils.h"
#include "chrome/common/net/gaia/gaia_urls.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
#include "chrome/common/net/url_util.h"
#include "net/base/escape.h"
#include "net/http/http_util.h"
+#include "third_party/libxml/chromium/libxml_utils.h"
using content::BrowserThread;
using content::URLFetcher;
diff --git a/chrome/browser/chromeos/gdata/gdata_parser.cc b/chrome/browser/chromeos/gdata/gdata_parser.cc
index 4ee0e3a..b51a805 100644
--- a/chrome/browser/chromeos/gdata/gdata_parser.cc
+++ b/chrome/browser/chromeos/gdata/gdata_parser.cc
@@ -13,7 +13,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/common/libxml_utils.h"
+#include "third_party/libxml/chromium/libxml_utils.h"
using base::Value;
using base::DictionaryValue;
diff --git a/chrome/browser/chromeos/gdata/gdata_parser_unittest.cc b/chrome/browser/chromeos/gdata/gdata_parser_unittest.cc
index 26f7ca2..c6dd674 100644
--- a/chrome/browser/chromeos/gdata/gdata_parser_unittest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_parser_unittest.cc
@@ -12,8 +12,8 @@
#include "base/values.h"
#include "chrome/browser/chromeos/gdata/gdata_parser.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/libxml_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/libxml/chromium/libxml_utils.h"
using base::Value;
using base::DictionaryValue;
diff --git a/chrome/browser/chromeos/gdata/gdata_util.cc b/chrome/browser/chromeos/gdata/gdata_util.cc
index 7b755b3..8674c93 100644
--- a/chrome/browser/chromeos/gdata/gdata_util.cc
+++ b/chrome/browser/chromeos/gdata/gdata_util.cc
@@ -19,7 +19,6 @@
#include "base/string_util.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/common/chrome_version_info.h"
-#include "chrome/common/libxml_utils.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/browser/chromeos/gdata/gdata_file_system.h"
@@ -33,6 +32,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "net/base/escape.h"
+#include "third_party/libxml/chromium/libxml_utils.h"
namespace gdata {
namespace util {
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index f3d9673..5c601a6 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -15,11 +15,11 @@
#include "chrome/browser/importer/importer_bridge.h"
#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/libxml_utils.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/url_fetcher.h"
#include "grit/generated_resources.h"
#include "net/base/load_flags.h"
+#include "third_party/libxml/chromium/libxml_utils.h"
using content::BrowserThread;
diff --git a/chrome/browser/importer/toolbar_importer_unittest.cc b/chrome/browser/importer/toolbar_importer_unittest.cc
index 29c0a35..832bb49 100644
--- a/chrome/browser/importer/toolbar_importer_unittest.cc
+++ b/chrome/browser/importer/toolbar_importer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -13,8 +13,8 @@
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/first_run/first_run_internal.h"
#include "chrome/browser/importer/toolbar_importer.h"
-#include "chrome/common/libxml_utils.h"
#include "googleurl/src/gurl.h"
+#include "third_party/libxml/chromium/libxml_utils.h"
// See http://crbug.com/11838
TEST(Toolbar5ImporterTest, BookmarkParse) {
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index b0a3075..cfd765f 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -229,8 +229,6 @@
'common/nacl_messages.h',
'common/nacl_types.cc',
'common/nacl_types.h',
- 'common/libxml_utils.cc',
- 'common/libxml_utils.h',
'common/pepper_flash.cc',
'common/pepper_flash.h',
'common/persistent_pref_store.h',
diff --git a/chrome/common/extensions/update_manifest.cc b/chrome/common/extensions/update_manifest.cc
index 60ac292..acc02b6 100644
--- a/chrome/common/extensions/update_manifest.cc
+++ b/chrome/common/extensions/update_manifest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -12,8 +12,8 @@
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
#include "base/version.h"
-#include "chrome/common/libxml_utils.h"
#include "libxml/tree.h"
+#include "third_party/libxml/chromium/libxml_utils.h"
static const char* kExpectedGupdateProtocol = "2.0";
static const char* kExpectedGupdateXmlns =
diff --git a/chrome/test/reliability/automated_ui_tests.cc b/chrome/test/reliability/automated_ui_tests.cc
index 7710f73..46b23b0 100644
--- a/chrome/test/reliability/automated_ui_tests.cc
+++ b/chrome/test/reliability/automated_ui_tests.cc
@@ -27,7 +27,6 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/env_vars.h"
-#include "chrome/common/libxml_utils.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/automation/automation_proxy.h"
#include "chrome/test/automation/browser_proxy.h"
diff --git a/chrome/test/reliability/automated_ui_tests.h b/chrome/test/reliability/automated_ui_tests.h
index 25bdccf..73fc5c0 100644
--- a/chrome/test/reliability/automated_ui_tests.h
+++ b/chrome/test/reliability/automated_ui_tests.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -105,6 +105,7 @@
#include "chrome/test/reliability/automated_ui_test_base.h"
#include "chrome/test/ui/ui_test.h"
+#include "third_party/libxml/chromium/libxml_utils.h"
#include "ui/base/keycodes/keyboard_codes.h"
namespace base {
diff --git a/third_party/libxml/README.chromium b/third_party/libxml/README.chromium
index f3dd98c..f6a1e2e 100644
--- a/third_party/libxml/README.chromium
+++ b/third_party/libxml/README.chromium
@@ -24,6 +24,7 @@ Modifications:
- Import XPath fix http://git.gnome.org/browse/libxml2/commit/xpath.c?id=2ddecc23862bab1a9a9e51e097aefc92ec305e28
- Merge clang warning fix http://git.gnome.org/browse/libxml2/commit/?id=aae48e64dfbf2b46b157a4c1857e30645116388f
- Add a fix for proper escaping of xpointer expressions, commit upstream is pending.
+- Add helper classes in chromium/libxml_utils.cc and chromium/include/libxml/libxml_utils.h.
To import a new snapshot of libxml:
diff --git a/chrome/common/libxml_utils.cc b/third_party/libxml/chromium/libxml_utils.cc
index 61d4237..63cbb6b 100644
--- a/chrome/common/libxml_utils.cc
+++ b/third_party/libxml/chromium/libxml_utils.cc
@@ -1,14 +1,8 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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/common/libxml_utils.h"
-
-#include "base/compiler_specific.h"
-#include "base/file_path.h"
-#include "base/logging.h"
-#include "base/stringprintf.h"
-#include "base/utf_string_conversions.h"
+#include "libxml_utils.h"
#include "libxml/xmlreader.h"
@@ -20,10 +14,7 @@ std::string XmlStringToStdString(const xmlChar* xmlstring) {
return "";
}
-XmlReader::XmlReader()
- : reader_(NULL),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- error_func_(this, &XmlReader::GenericErrorCallback)) {
+XmlReader::XmlReader() : reader_(NULL) {
}
XmlReader::~XmlReader() {
@@ -31,16 +22,6 @@ XmlReader::~XmlReader() {
xmlFreeTextReader(reader_);
}
-// static
-void XmlReader::GenericErrorCallback(void* context, const char* msg, ...) {
- va_list args;
- va_start(args, msg);
-
- XmlReader* reader = static_cast<XmlReader*>(context);
- reader->errors_.append(base::StringPrintV(msg, args));
- va_end(args);
-}
-
bool XmlReader::Load(const std::string& input) {
const int kParseOptions = XML_PARSE_RECOVER | // recover on errors
XML_PARSE_NONET; // forbid network access
@@ -51,19 +32,10 @@ bool XmlReader::Load(const std::string& input) {
return reader_ != NULL;
}
-bool XmlReader::LoadFile(const FilePath& file_path) {
+bool XmlReader::LoadFile(const std::string& file_path) {
const int kParseOptions = XML_PARSE_RECOVER | // recover on errors
XML_PARSE_NONET; // forbid network access
- reader_ = xmlReaderForFile(
-#if defined(OS_WIN)
- // libxml takes UTF-8 paths on Windows; search the source for
- // xmlWrapOpenUtf8 to see it converting UTF-8 back to wide
- // characters.
- WideToUTF8(file_path.value()).c_str(),
-#else
- file_path.value().c_str(),
-#endif
- NULL, kParseOptions);
+ reader_ = xmlReaderForFile(file_path.c_str(), NULL, kParseOptions);
return reader_ != NULL;
}
@@ -77,7 +49,6 @@ bool XmlReader::NodeAttribute(const char* name, std::string* out) {
}
bool XmlReader::ReadElementContent(std::string* content) {
- DCHECK(NodeType() == XML_READER_TYPE_ELEMENT);
const int start_depth = Depth();
if (xmlTextReaderIsEmptyElement(reader_)) {
@@ -103,7 +74,6 @@ bool XmlReader::ReadElementContent(std::string* content) {
}
// Advance past ending element tag.
- DCHECK_EQ(NodeType(), XML_READER_TYPE_END_ELEMENT);
if (!Read())
return false;
diff --git a/chrome/common/libxml_utils.h b/third_party/libxml/chromium/libxml_utils.h
index cf53341..d230c5d 100644
--- a/chrome/common/libxml_utils.h
+++ b/third_party/libxml/chromium/libxml_utils.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
-#ifndef CHROME_COMMON_LIBXML_UTILS_H__
-#define CHROME_COMMON_LIBXML_UTILS_H__
+#ifndef THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
+#define THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
#pragma once
#include <string>
@@ -11,8 +11,6 @@
#include "libxml/xmlreader.h"
#include "libxml/xmlwriter.h"
-class FilePath;
-
// Converts a libxml xmlChar* into a UTF-8 std::string.
// NULL inputs produce an empty string.
std::string XmlStringToStdString(const xmlChar* xmlstring);
@@ -49,7 +47,7 @@ class XmlReader {
bool Load(const std::string& input);
// Load a document into the reader from a file. Returns false on error.
- bool LoadFile(const FilePath& file_path);
+ bool LoadFile(const std::string& file_path);
// Wrappers around libxml functions -----------------------------------------
@@ -90,24 +88,12 @@ class XmlReader {
// If currently on an opening tag, doesn't advance at all.
bool SkipToElement();
- // Returns the errors reported by libxml, if any.
- // (libxml normally just dumps these errors to stderr.)
- const std::string& errors() const { return errors_; }
-
private:
- // A callback for libxml to report errors.
- static void GenericErrorCallback(void* context, const char* msg, ...);
-
// Returns the libxml node type of the current node.
int NodeType() { return xmlTextReaderNodeType(reader_); }
// The underlying libxml xmlTextReader.
xmlTextReaderPtr reader_;
-
- // error_func_ is used to reassign libxml's global error function
- // to report errors into |errors_| for the lifetime of this object.
- ScopedXmlErrorFunc error_func_;
- std::string errors_;
};
// XmlWriter is a wrapper class around libxml's xmlWriter,
@@ -182,4 +168,4 @@ class XmlWriter {
xmlBufferPtr buffer_;
};
-#endif // CHROME_COMMON_LIBXML_UTILS_H__
+#endif // THIRD_PARTY_LIBXML_CHROMIUM_INCLUDE_LIBXML_LIBXML_UTILS_H_
diff --git a/third_party/libxml/libxml.gyp b/third_party/libxml/libxml.gyp
index 621bc98..ac40290 100644
--- a/third_party/libxml/libxml.gyp
+++ b/third_party/libxml/libxml.gyp
@@ -20,7 +20,17 @@
'target_name': 'libxml',
'conditions': [
['os_posix == 1 and OS != "mac" and use_system_libxml', {
- 'type': 'none',
+ 'type': 'static_library',
+ 'sources': [
+ 'chromium/libxml_utils.h',
+ 'chromium/libxml_utils.cc',
+ ],
+ 'cflags': [
+ '<!@(pkg-config --cflags libxml-2.0)',
+ ],
+ 'defines': [
+ 'USE_SYSTEM_LIBXML',
+ ],
'direct_dependent_settings': {
'cflags': [
'<!@(pkg-config --cflags libxml-2.0)',
@@ -40,6 +50,8 @@
}, { # else: os_posix != 1 or OS == "mac" or ! use_system_libxml
'type': 'static_library',
'sources': [
+ 'chromium/libxml_utils.h',
+ 'chromium/libxml_utils.cc',
'linux/config.h',
'linux/include/libxml/xmlversion.h',
'mac/config.h',