Changeset 30092 in webkit


Ignore:
Timestamp:
Feb 8, 2008 8:24:14 AM (16 years ago)
Author:
Adam Roben
Message:

2008-02-08 Rodney Dawes <dobey@wayofthemonkey.com>

Reviewed by Jon Honeycutt.

Redefine some platform-specific types as cross-platform types
Add pathGetFileName method to get the filename from a path string
Add unloadModule method to unload a loadable module from the process
Implement new methods for GTK+ and Windows
Implement missing homeDirectoryPath method for GTK+
Add stub methods for new and missing methods for Wx and Qt

  • platform/FileSystem.h:
  • platform/gtk/FileSystemGtk.cpp:
  • platform/qt/FileSystemQt.cpp:
  • platform/win/FileSystemWin.cpp:
  • platform/wx/FileSystemWx.cpp:
Location:
trunk/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r30091 r30092  
     12008-02-08  Rodney Dawes  <dobey@wayofthemonkey.com>
     2
     3        Reviewed by Jon Honeycutt.
     4
     5        Redefine some platform-specific types as cross-platform types
     6        Add pathGetFileName method to get the filename from a path string
     7        Add unloadModule method to unload a loadable module from the process
     8        Implement new methods for GTK+ and Windows
     9        Implement missing homeDirectoryPath method for GTK+
     10        Add stub methods for new and missing methods for Wx and Qt
     11
     12        * platform/FileSystem.h:
     13        * platform/gtk/FileSystemGtk.cpp:
     14        * platform/qt/FileSystemQt.cpp:
     15        * platform/win/FileSystemWin.cpp:
     16        * platform/wx/FileSystemWx.cpp:
     17
    1182008-02-08  Adam Roben  <aroben@apple.com>
    219
  • trunk/WebCore/platform/FileSystem.h

    r30078 r30092  
    3131#define FileSystem_h
    3232
     33#if PLATFORM(GTK)
     34#include <gmodule.h>
     35#endif
     36
    3337#include <wtf/Platform.h>
    3438
     
    4246#if PLATFORM(WIN)
    4347typedef HANDLE PlatformFileHandle;
     48typedef FILETIME PlatformFileTime;
     49typedef HMODULE PlatformModule;
    4450const PlatformFileHandle invalidPlatformFileHandle = INVALID_HANDLE_VALUE;
    4551#else
    4652typedef int PlatformFileHandle;
     53typedef time_t PlatformFileTime;
     54#if PLATFORM(GTK)
     55typedef GModule* PlatformModule;
     56#else
     57typedef void* PlatformModule;
     58#endif
    4759const PlatformFileHandle invalidPlatformFileHandle = -1;
    4860#endif
     
    5668bool makeAllDirectories(const String& path);
    5769String homeDirectoryPath();
     70String pathGetFileName(const String&);
    5871
    5972CString fileSystemRepresentation(const String&);
     
    6578void closeFile(PlatformFileHandle&);
    6679int writeToFile(PlatformFileHandle, const char* data, int length);
     80
     81// Methods for dealing with loadable modules
     82bool unloadModule(PlatformModule);
    6783
    6884#if PLATFORM(WIN)
  • trunk/WebCore/platform/gtk/FileSystemGtk.cpp

    r30080 r30092  
    114114}
    115115
     116String homeDirectoryPath()
     117{
     118    return String::fromUTF8(g_get_home_dir());
     119}
     120
     121String pathGetFileName(const String& pathName)
     122{
     123    char* baseName = g_path_get_basename(pathName.utf8().data());
     124    String fileName = String::fromUTF8(baseName);
     125    g_free(baseName);
     126
     127    return fileName;
     128}
     129
    116130CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle)
    117131{
     
    153167    return totalBytesWritten;
    154168}
     169
     170bool unloadModule(PlatformModule module)
     171{
     172    return g_module_close(module);
    155173}
     174}
  • trunk/WebCore/platform/qt/FileSystemQt.cpp

    r30080 r30092  
    33 * Copyright (C) 2007 Holger Hans Peter Freyther
    44 * Copyright (C) 2008 Apple, Inc. All rights reserved.
     5 * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
    56 *
    67 * Redistribution and use in source and binary forms, with or without
     
    2930 */
    3031
     32#include "config.h"
     33#include "FileSystem.h"
     34
     35#include "CString.h"
    3136#include "NotImplemented.h"
    3237#include "PlatformString.h"
     
    7681}
    7782
     83String pathGetFileName(const String&)
     84{
     85    notImplemented();
     86    return String();
     87}
     88
     89bool unloadModule(PlatformModule)
     90{
     91    notImplemented();
     92    return false;
     93}
     94
    7895}
    7996
  • trunk/WebCore/platform/win/FileSystemWin.cpp

    r30078 r30092  
    127127}
    128128
     129String pathGetFileName(const String& path)
     130{
     131    return String(PathFindFileName(String(path).charactersWithNullTermination()));
     132}
     133
    129134static String bundleName()
    130135{
     
    215220    return static_cast<int>(bytesWritten);
    216221}
     222
     223bool unloadModule(PlatformModule module)
     224{
     225    return ::FreeLibrary(module);
     226}
     227
    217228String localUserSpecificStorageDirectory()
    218229{
  • trunk/WebCore/platform/wx/FileSystemWx.cpp

    r30078 r30092  
    11/*
    22 * Copyright (C) 2007 Kevin Ollivier
     3 * Copyright (C) 2008 Collabora, Ltd.
     4 *
    35 * All rights reserved.
    4  *
     6 * 
    57 * Redistribution and use in source and binary forms, with or without
    68 * modification, are permitted provided that the following conditions
     
    7678}
    7779
     80String homeDirectoryPath()
     81{
     82    notImplemented();
     83    return String();
    7884}
     85
     86String pathGetFileName(const String&)
     87{
     88    notImplemented();
     89    return String();
     90}
     91
     92CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle)
     93{
     94    notImplemented();
     95    handle = invalidPlatformFileHandle;
     96    return CString();
     97}
     98
     99void closeFile(PlatformFileHandle&)
     100{
     101    notImplemented();
     102}
     103
     104int writeToFile(PlatformFileHandle, const char* data, int length)
     105{
     106    notImplemented();
     107    return 0;
     108}
     109
     110bool unloadModule(PlatformModule)
     111{
     112    notImplemented();
     113    return false;
     114}
     115
     116}
Note: See TracChangeset for help on using the changeset viewer.