summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaruel@google.com <maruel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-06 20:35:17 +0000
committermaruel@google.com <maruel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-06 20:35:17 +0000
commitc9046afea46a4b8252392adced73f3d2a9fb354e (patch)
treec557a80884a379eecf170e3cf88acee77bc4d837
parenta4930c88e7fb14ba66340cbe393fcdf4c668e41c (diff)
downloadchromium_src-c9046afea46a4b8252392adced73f3d2a9fb354e.zip
chromium_src-c9046afea46a4b8252392adced73f3d2a9fb354e.tar.gz
chromium_src-c9046afea46a4b8252392adced73f3d2a9fb354e.tar.bz2
Fix base::DIR_SOURCE_ROOT path calculation.
Add missing header files to base.vcproj. Fix thread local storage implicit destructor call on Windows x64. Fix build compilation issues in x64 with third party headers. Fix Pickle for x64, the header doesn't need to be size_t, uint32 ought to be sufficient for the object. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@450 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/base_paths.cc36
-rw-r--r--base/build/base.vcproj28
-rw-r--r--base/gfx/platform_canvas.cc5
-rw-r--r--base/pickle.cc12
-rw-r--r--base/pickle.h8
-rw-r--r--base/third_party/nspr/prtypes.h8
-rw-r--r--base/third_party/nss/sha512.cc7
-rw-r--r--base/thread_local_storage_win.cc4
8 files changed, 92 insertions, 16 deletions
diff --git a/base/base_paths.cc b/base/base_paths.cc
index ed0a489..2c69cef 100644
--- a/base/base_paths.cc
+++ b/base/base_paths.cc
@@ -31,9 +31,23 @@
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/string_util.h"
namespace base {
+namespace {
+
+// List of directory name prefixes to skip when calculating
+// base::DIR_SOURCE_ROOT.
+const wchar_t* const kPathToStrip[] = {
+ L"release",
+ L"debug",
+ L"win32",
+ L"x64",
+};
+
+} // namespace
+
bool PathProvider(int key, std::wstring* result) {
// NOTE: DIR_CURRENT is a special cased in PathService::Get
@@ -52,10 +66,26 @@ bool PathProvider(int key, std::wstring* result) {
return false;
break;
case base::DIR_SOURCE_ROOT:
- // By default, unit tests execute two levels deep from the source root.
- // For example: chrome/{Debug|Release}/ui_tests.exe
PathProvider(base::DIR_EXE, &cur);
- file_util::UpOneDirectory(&cur);
+ for (;;) {
+ bool found = false;
+ std::wstring bottom_dir(file_util::GetFilenameFromPath(cur));
+ for (int i = 0; i < arraysize(kPathToStrip); ++i) {
+ if (0 == wcsncmp(bottom_dir.c_str(),
+ kPathToStrip[i],
+ wcslen(kPathToStrip[i]))) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ break;
+
+ // Skip this directory.
+ file_util::UpOneDirectory(&cur);
+ }
+
+ // Then skip one more for the solution directory.
file_util::UpOneDirectory(&cur);
break;
default:
diff --git a/base/build/base.vcproj b/base/build/base.vcproj
index 4e696c3..0e23ba5 100644
--- a/base/build/base.vcproj
+++ b/base/build/base.vcproj
@@ -134,6 +134,22 @@
>
</File>
<File
+ RelativePath="..\atomic_ref_count.h"
+ >
+ </File>
+ <File
+ RelativePath="..\atomic_sequence_num.h"
+ >
+ </File>
+ <File
+ RelativePath="..\atomicops.h"
+ >
+ </File>
+ <File
+ RelativePath="..\atomicops_internals_x86_msvc.h"
+ >
+ </File>
+ <File
RelativePath="..\base_drag_source.cc"
>
</File>
@@ -186,10 +202,18 @@
>
</File>
<File
+ RelativePath="..\..\build\build_config.h"
+ >
+ </File>
+ <File
RelativePath="..\bzip2_error_handler.cc"
>
</File>
<File
+ RelativePath="..\check_handler.h"
+ >
+ </File>
+ <File
RelativePath="..\clipboard.cc"
>
</File>
@@ -274,6 +298,10 @@
>
</File>
<File
+ RelativePath="..\hash_tables.h"
+ >
+ </File>
+ <File
RelativePath="..\histogram.cc"
>
</File>
diff --git a/base/gfx/platform_canvas.cc b/base/gfx/platform_canvas.cc
index a421069..ec80f4f 100644
--- a/base/gfx/platform_canvas.cc
+++ b/base/gfx/platform_canvas.cc
@@ -32,6 +32,11 @@
#include "base/gfx/bitmap_platform_device.h"
#include "base/logging.h"
+#ifdef ARCH_CPU_64_BITS
+#error This code does not work on x64. Please make sure all the base unit tests\
+ pass before doing any real work.
+#endif
+
namespace gfx {
PlatformCanvas::PlatformCanvas() : SkCanvas() {
diff --git a/base/pickle.cc b/base/pickle.cc
index a16368b..0fb1d9c 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -27,10 +27,12 @@
// (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 "base/pickle.h"
+
#include <stdlib.h>
-#include <string>
-#include "base/pickle.h"
+#include <limits>
+#include <string>
//------------------------------------------------------------------------------
@@ -240,7 +242,11 @@ char* Pickle::BeginWrite(size_t length) {
if (header_size_ + new_size > capacity_ && !Resize(header_size_ + new_size))
return NULL;
- header_->payload_size = new_size;
+#ifdef ARCH_CPU_64_BITS
+ DCHECK_LE(length, std::numeric_limits<uint32>::max());
+#endif
+
+ header_->payload_size = static_cast<uint32>(new_size);
return payload() + offset;
}
diff --git a/base/pickle.h b/base/pickle.h
index 5e97ff5..7c4a007 100644
--- a/base/pickle.h
+++ b/base/pickle.h
@@ -147,9 +147,9 @@ class Pickle {
// not been changed.
void TrimWriteData(int length);
- // payload follows after allocation of Header (header size is customizable)
+ // Payload follows after allocation of Header (header size is customizable).
struct Header {
- size_t payload_size; // specifies the size of the payload
+ uint32 payload_size; // Specifies the size of the payload.
};
// Returns the header, cast to a user-specified type T. The type T must be a
@@ -218,14 +218,14 @@ class Pickle {
bool Resize(size_t new_capacity);
// Aligns 'i' by rounding it up to the next multiple of 'alignment'
- static inline size_t AlignInt(size_t i, int alignment) {
+ static size_t AlignInt(size_t i, int alignment) {
return i + (alignment - (i % alignment)) % alignment;
}
// Moves the iterator by the given number of bytes, making sure it is aligned.
// Pointer (iterator) is NOT aligned, but the change in the pointer
// is guaranteed to be a multiple of sizeof(uint32).
- static inline void UpdateIter(void** iter, int bytes) {
+ static void UpdateIter(void** iter, int bytes) {
*iter = static_cast<char*>(*iter) + AlignInt(bytes, sizeof(uint32));
}
diff --git a/base/third_party/nspr/prtypes.h b/base/third_party/nspr/prtypes.h
index e9e41c2..d77a2a4 100644
--- a/base/third_party/nspr/prtypes.h
+++ b/base/third_party/nspr/prtypes.h
@@ -52,6 +52,14 @@
#ifndef prtypes_h___
#define prtypes_h___
+#include "build/build_config.h"
+
+#ifdef OS_WIN
+// This files assumes windows.h has been included first since it expects _X86_
+// or _AMD64_ to be defined.
+#include <windows.h>
+#endif // OS_WIN
+
#ifdef MDCPUCFG
#include MDCPUCFG
#else
diff --git a/base/third_party/nss/sha512.cc b/base/third_party/nss/sha512.cc
index d17f532c..5a02f46 100644
--- a/base/third_party/nss/sha512.cc
+++ b/base/third_party/nss/sha512.cc
@@ -42,16 +42,11 @@
// size from ~10k to ~1k. The performance should be reasonable for our use.
#define NOUNROLL256 1
-#if defined(_M_IX86) || defined(i386) || defined(__i386) || defined(__i386__)
-#define _X86_ 1
-#endif
-
-#include "base/third_party/nspr/prcpucfg.h"
+#include "base/third_party/nspr/prtypes.h" /* for PRUintXX */
#if defined(_X86_) || defined(SHA_NO_LONG_LONG)
#define NOUNROLL512 1
#undef HAVE_LONG_LONG
#endif
-#include "base/third_party/nspr/prtypes.h" /* for PRUintXX */
#include "base/third_party/nss/blapi.h"
#include "base/third_party/nss/sha256.h" /* for struct SHA256ContextStr */
diff --git a/base/thread_local_storage_win.cc b/base/thread_local_storage_win.cc
index 4d56b08..fc38323 100644
--- a/base/thread_local_storage_win.cc
+++ b/base/thread_local_storage_win.cc
@@ -181,6 +181,10 @@ void NTAPI OnThreadExit(PVOID module, DWORD reason, PVOID reserved)
// .CRT section is merged with .rdata on x64 so it must be constant data.
#pragma const_seg(".CRT$XLB")
+// When defining a const variable, it must have external linkage to be sure the
+// linker doesn't discard it. If this value is discarded, the OnThreadExit
+// function will never be called.
+extern const PIMAGE_TLS_CALLBACK p_thread_callback;
const PIMAGE_TLS_CALLBACK p_thread_callback = OnThreadExit;
// Reset the default section.