+2006-06-01 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Maciej.
+
+ Added the beginnings of sqlite-based code in a WebCore
+ based version of the Icon Database. Right now the code
+ is very loosely hooked up through a Bridge and only
+ creates an sqlite3 database.
+
+ There are also changes to our String classes to allow appending
+ a single character to a String without creating a temporary object.
+
+ * WebCore.exp:
+ -Added a symbol export
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * bridge/mac/WebCoreIconDatabaseBridge.h: Added.
+ * bridge/mac/WebCoreIconDatabaseBridge.mm: Added.
+ (-[WebCoreIconDatabaseBridge openSharedDatabaseWithPath:]):
+ (-[WebCoreIconDatabaseBridge closeSharedDatabase]):
+ (-[WebCoreIconDatabaseBridge isOpen]):
+ -This class will eventually shadow WebIconDatabase but for now
+ is a minimal interface to make the sql code live
+
+ * icon: Added.
+ * icon/IconDatabase.cpp: Added.
+ -This class will eventually resemble WebIconDatabase but for now
+ is minimal just to make the sql code live
+ (WebCore::IconDatabase::sharedIconDatabase):
+ (WebCore::IconDatabase::IconDatabase):
+ (WebCore::IconDatabase::open):
+ -This method calls a mkdir to make sure the target directory
+ exists
+ (WebCore::IconDatabase::close):
+ (WebCore::IconDatabase::~IconDatabase):
+
+ * icon/IconDatabase.h: Added.
+ (WebCore::IconDatabase::isOpen):
+ * platform/Logging.cpp:
+ * platform/Logging.h:
+ -Added an IconDatabase logging channel
+
+ * platform/PlatformString.h:
+ * platform/String.cpp:
+ (WebCore::String::append):
+ * platform/StringImpl.cpp:
+ (WebCore::StringImpl::append):
+ * platform/StringImpl.h:
+ -Added append(char) and append(UChar) to allow appending a
+ single character without creating a temporary object. Required
+ to facilitate manually adding a null character to a unicode 16
+ string
+
2006-06-01 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed and landed by Anders.
.objc_class_name_WebCoreFrameBridge
.objc_class_name_WebCoreFrameNamespaces
.objc_class_name_WebCoreHistory
+.objc_class_name_WebCoreIconDatabaseBridge
.objc_class_name_WebCoreImageRendererFactory
.objc_class_name_WebCoreJavaScript
.objc_class_name_WebCoreKeyGenerator
1AE2AEC80A1D297B00B42B25 /* JSHTMLQuoteElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE2AEC40A1D297B00B42B25 /* JSHTMLQuoteElement.h */; };
1AE2AEE60A1D2A7500B42B25 /* JSHTMLBlockquoteElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE2AEE40A1D2A7500B42B25 /* JSHTMLBlockquoteElement.cpp */; };
1AE2AEE70A1D2A7500B42B25 /* JSHTMLBlockquoteElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE2AEE50A1D2A7500B42B25 /* JSHTMLBlockquoteElement.h */; };
+ 5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */; };
+ 5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 5126E6BF0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BD0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 5126E6C00A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6BE0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm */; };
550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; };
650F53DC09D15DDA00C9B0C8 /* CSSGrammar.h in Headers */ = {isa = PBXBuildFile; fileRef = 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */; };
2D90660B0665D937006B6F1A /* ClipboardMac.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardMac.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
2D90660C0665D937006B6F1A /* ClipboardMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ClipboardMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
4758C44308C5F217009BAF05 /* KCanvasPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KCanvasPath.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ 5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconDatabase.cpp; sourceTree = "<group>"; };
+ 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconDatabase.h; sourceTree = "<group>"; };
+ 5126E6BD0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreIconDatabaseBridge.h; sourceTree = "<group>"; };
+ 5126E6BE0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreIconDatabaseBridge.mm; sourceTree = "<group>"; };
5150C2A10702629000AF642C /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
5150C2A50702629800AF642C /* WebDashboardRegion.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDashboardRegion.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
51F6A3D50663BF04004D2919 /* HTMLCanvasElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLCanvasElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D32402DE4478018635CA /* dom */,
93309D86099E64910056E581 /* editing */,
93EEC1EC09C2877700C515D1 /* html */,
+ 5126E6B60A2E3AEF005C29FA /* icon */,
A8C0FB51089701F700BA5114 /* kcanvas */,
A8C0F6E9089701F100BA5114 /* ksvg2 */,
F58785E802DE377601EA4122 /* kwq */,
path = impl;
sourceTree = "<group>";
};
+ 5126E6B60A2E3AEF005C29FA /* icon */ = {
+ isa = PBXGroup;
+ children = (
+ 5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */,
+ 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */,
+ );
+ path = icon;
+ sourceTree = "<group>";
+ };
55998A57052B598F0017A6C1 /* Accessibility */ = {
isa = PBXGroup;
children = (
6552E7A8096AA11B0006F248 /* WebCoreFrameNamespaces.h */,
6552E7A9096AA11B0006F248 /* WebCoreFrameNamespaces.mm */,
F587854C02DE375901EA4122 /* WebCoreFrameView.h */,
+ 5126E6BD0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h */,
+ 5126E6BE0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm */,
F5B2A52B02E22573018635CB /* WebCoreJavaScript.h */,
F5B2A52C02E22573018635CB /* WebCoreJavaScript.mm */,
BE983D95052A2E0A00892D85 /* WebCoreKeyboardAccess.h */,
A833C1000A2C513300D57664 /* JSSVGTransform.h in Headers */,
A833C6D80A2CEA7700D57664 /* JSSVGElementWrapperFactory.h in Headers */,
A833C80D0A2CF25600D57664 /* XMLNames.h in Headers */,
+ 5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */,
+ 5126E6BF0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
A833C7CC0A2CF07400D57664 /* XLinkNames.cpp in Sources */,
A833C80C0A2CF25600D57664 /* XMLNames.cpp in Sources */,
A833C8520A2CF52800D57664 /* SVGElementFactory.cpp in Sources */,
+ 5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */,
+ 5126E6C00A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
OTHER_LDFLAGS = (
"$(STYLE_LDFLAGS)",
+ "-lsqlite3",
"-Wl,-exported_symbols_list,WebCore.exp,-Y,3",
);
PRODUCT_NAME = WebCore;
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
OTHER_LDFLAGS = (
"$(STYLE_LDFLAGS)",
+ "-lsqlite3",
"-Wl,-exported_symbols_list,WebCore.exp,-Y,3",
);
PRODUCT_NAME = WebCore;
INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks";
OTHER_LDFLAGS = (
"$(STYLE_LDFLAGS)",
+ "-lsqlite3",
"-Wl,-exported_symbols_list,WebCore.exp,-Y,3",
);
PRODUCT_NAME = WebCore;
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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.
+ */
+
+#ifdef __cplusplus
+namespace WebCore { class IconDatabase; }
+typedef WebCore::IconDatabase WebCoreIconDatabase;
+#else
+@class WebCoreIconDatabase;
+#endif
+
+@interface WebCoreIconDatabaseBridge : NSObject
+{
+ WebCoreIconDatabase *_iconDB;
+}
+- (BOOL)openSharedDatabaseWithPath:(NSString *)path;
+- (void)closeSharedDatabase;
+- (BOOL)isOpen;
+@end
+
+
+
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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.
+ */
+
+#import "config.h"
+#import "WebCoreIconDatabaseBridge.h"
+
+#import "Logging.h"
+#import "IconDatabase.h"
+#import "PlatformString.h"
+
+using WebCore::IconDatabase;
+using WebCore::String;
+
+@implementation WebCoreIconDatabaseBridge
+
+- (BOOL)openSharedDatabaseWithPath:(NSString *)path;
+{
+ assert(path);
+
+ _iconDB = IconDatabase::sharedIconDatabase();
+ if (_iconDB) {
+ _iconDB->open((String([path stringByStandardizingPath])));
+ return _iconDB->isOpen() ? YES : NO;
+ }
+ return NO;
+}
+
+- (void)closeSharedDatabase;
+{
+ LOG( IconDatabase, "Closing IconDatabase" );
+ if (_iconDB) {
+ _iconDB->close();
+ _iconDB = 0;
+ }
+}
+
+- (BOOL)isOpen;
+{
+ return _iconDB != 0;
+}
+@end
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "IconDatabase.h"
+
+#include "DeprecatedString.h"
+#include "Logging.h"
+#include "PlatformString.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+const char* DefaultIconDatabaseFilename = "/icon.db";
+
+namespace WebCore {
+
+IconDatabase* IconDatabase::m_sharedInstance = 0;
+
+IconDatabase* IconDatabase::sharedIconDatabase()
+{
+ if (!m_sharedInstance) {
+ m_sharedInstance = new IconDatabase();
+ }
+ return m_sharedInstance;
+}
+
+IconDatabase::IconDatabase() : m_db(0)
+{
+
+}
+
+bool IconDatabase::open(const String& databasePath)
+{
+ close();
+
+ //Make sure directory exists
+ DeprecatedString ds = databasePath.deprecatedString();
+ const char* path = ds.ascii();
+
+ struct stat dirInfo;
+ if (stat(path, &dirInfo)) {
+ LOG_ERROR("Unable to stat icon database path %s (%i)", path, errno);
+ return false;
+ }
+ if (dirInfo.st_mode & S_IRWXU != S_IRWXU) {
+ LOG_ERROR("Unable to access icon database path %s", path);
+ return false;
+ }
+
+ String dbFilename = databasePath + DefaultIconDatabaseFilename;
+ //specifically include the null-terminator as sqlite3 expects it on unicode-16 strings
+ dbFilename.append('\0');
+
+ int result = sqlite3_open16(dbFilename.characters(), &m_db);
+ if (result != SQLITE_OK) {
+ LOG_ERROR("SQLite database failed to load from %s\nCause - %s", dbFilename.ascii(),
+ sqlite3_errmsg(m_db));
+ sqlite3_close(m_db);
+ m_db = 0;
+ }
+ return m_db;
+}
+
+void IconDatabase::close()
+{
+ if (m_db) {
+ sqlite3_close(m_db);
+ m_db = 0;
+ }
+}
+
+IconDatabase::~IconDatabase()
+{
+ if (!m_db)
+ return;
+
+ int result = sqlite3_close(m_db);
+ if (result != SQLITE_OK)
+ LOG_ERROR("IconDatabase SQLite database failed to close\n%s", sqlite3_errmsg(m_db));
+}
+
+} //namespace WebCore
+
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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.
+ */
+
+#ifndef ICONDATABASE_H
+#define ICONDATABASE_H
+
+#include "config.h"
+
+#include "PlatformString.h"
+#include "sqlite3.h"
+
+namespace WebCore {
+
+class IconDatabase
+{
+public:
+ static IconDatabase* sharedIconDatabase();
+
+ void close();
+ bool open(const String& path);
+ bool isOpen() { return m_db; }
+
+private:
+ IconDatabase();
+ ~IconDatabase();
+
+ static IconDatabase* m_sharedInstance;
+
+ sqlite3* m_db;
+
+};
+
+} //namespace WebCore
+
+#endif
WTFLogChannel LogEvents = { 0x00000080, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogEditing = { 0x00000100, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogTextConversion = { 0x00000200, "WebCoreLogLevel", WTFLogChannelOff };
+
+WTFLogChannel LogIconDatabase = { 0x00000400, "WebCoreLogLevel", WTFLogChannelOn };
extern WTFLogChannel LogEvents;
extern WTFLogChannel LogEditing;
extern WTFLogChannel LogTextConversion;
+extern WTFLogChannel LogIconDatabase;
#endif
{ return m_impl ? m_impl->endsWith(s.impl(), caseSensitive) : s.isEmpty(); }
void append(const String&);
+ void append(char);
+ void append(UChar);
void insert(const String&, unsigned pos);
String& replace(UChar a, UChar b) { if (m_impl) m_impl = m_impl->replace(a, b); return *this; }
}
}
+void String::append(char c)
+{
+ if (!m_impl)
+ m_impl = new StringImpl(&c, 1);
+ else
+ m_impl->append(c);
+}
+
+void String::append(UChar c)
+{
+ if (!m_impl)
+ m_impl = new StringImpl(&c, 1);
+ else
+ m_impl->append(c);
+}
+
String operator+(const String& a, const String& b)
{
if (a.isEmpty())
}
}
+void StringImpl::append(char c)
+{
+ append(UChar(c));
+}
+
+void StringImpl::append(UChar c)
+{
+ assert(!m_inTable);
+ UChar* nc = newUCharVector(m_length + 1);
+ memcpy(nc, m_data, m_length * sizeof(UChar));
+ nc[m_length] = c;
+ deleteUCharVector(m_data);
+ m_data = nc;
+ m_length++;
+}
+
void StringImpl::insert(const StringImpl* str, unsigned pos)
{
assert(!m_inTable);
static unsigned computeHash(const char*);
void append(const StringImpl*);
+ void append(char);
+ void append(UChar);
void insert(const StringImpl*, unsigned pos);
void truncate(int len);
void remove(unsigned pos, int len = 1);
+2006-06-01 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Maciej.
+
+ Simple changes to hook up the new WebCore based Icon Database
+ for testing.
+
+ * ChangeLog:
+ * Misc/WebIconDatabase.m:
+ (-[WebIconDatabase _applicationWillTerminate:]):
+ * Misc/WebIconDatabasePrivate.h:
+ * WebKit.xcodeproj/project.pbxproj:
+
2006-06-01 Anders Carlsson <acarlsson@apple.com>
Reviewed by Darin.
#import <WebKit/WebNSURLExtras.h>
#import <WebKit/WebPreferences.h>
+#import <WebCore/WebCoreIconDatabaseBridge.h>
+
#import "WebTypesInternal.h"
NSString * const WebIconDatabaseVersionKey = @"WebIconDatabaseVersion";
NSString *WebIconDatabaseDirectoryDefaultsKey = @"WebIconDatabaseDirectoryDefaultsKey";
NSString *WebIconDatabaseEnabledDefaultsKey = @"WebIconDatabaseEnabled";
+NSString *WebIconDatabasePath = @"~/Library/Safari/Icons";
+
NSSize WebIconSmallSize = {16, 16};
NSSize WebIconMediumSize = {32, 32};
NSSize WebIconLargeSize = {128, 128};
[self _createFileDatabase];
[self _loadIconDictionaries];
+ _private->databaseBridge = [[WebCoreIconDatabaseBridge alloc] init];
+ if (_private->databaseBridge) {
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ NSString *databaseDirectory = [defaults objectForKey:WebIconDatabaseDirectoryDefaultsKey];
+
+ if (!databaseDirectory) {
+ databaseDirectory = WebIconDatabasePath;
+ [defaults setObject:databaseDirectory forKey:WebIconDatabaseDirectoryDefaultsKey];
+ }
+ databaseDirectory = [databaseDirectory stringByExpandingTildeInPath];
+ [_private->databaseBridge openSharedDatabaseWithPath:databaseDirectory];
+ }
+
_private->iconURLToIcons = [[NSMutableDictionary alloc] init];
_private->iconURLToExtraRetainCount = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, NULL);
_private->pageURLToRetainCount = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, NULL);
{
// Should only cause a write if user quit before 3 seconds after the last _updateFileDatabase
[_private->fileDatabase sync];
+
+ [_private->databaseBridge closeSharedDatabase];
}
- (int)_totalRetainCountForIconURLString:(NSString *)iconURLString
#import <WebKit/WebIconDatabase.h>
@class WebFileDatabase;
+@class WebCoreIconDatabaseBridge;
@interface WebIconDatabasePrivate : NSObject {
@public
WebFileDatabase *fileDatabase;
+ WebCoreIconDatabaseBridge *databaseBridge;
NSMutableDictionary *iconURLToIcons;
NSMutableDictionary *iconURLToPageURLs;
ED7F6D8B0980683500C235ED /* WebNSDataExtrasPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7F6D8A0980683500C235ED /* WebNSDataExtrasPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
/* End PBXBuildFile section */
+/* Begin PBXBuildStyle section */
+ 5139C0C70A265D25001AFADD /* Development */ = {
+ isa = PBXBuildStyle;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ };
+ name = Development;
+ };
+ 5139C0C80A265D25001AFADD /* Deployment */ = {
+ isa = PBXBuildStyle;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ };
+ name = Deployment;
+ };
+/* End PBXBuildStyle section */
+
/* Begin PBXFileReference section */
1C68F640095B5FC100C2984E /* webInspector */ = {isa = PBXFileReference; lastKnownFileType = folder; name = webInspector; path = WebInspector/webInspector; sourceTree = SOURCE_ROOT; };
1C68F65C095B5FC100C2984E /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
+ buildSettings = {
+ };
+ buildStyles = (
+ 5139C0C70A265D25001AFADD /* Development */,
+ 5139C0C80A265D25001AFADD /* Deployment */,
+ );
hasScannedForEncodings = 1;
knownRegions = (
English,