Commit cd46164f authored by andersca@apple.com's avatar andersca@apple.com
Browse files

2008-10-29 Anders Carlsson <andersca@apple.com>

        Reviewed by Sam Weinig.

        Remove the WebBaseNetscapePluginStream Objective-C object.
        
        * Plugins/WebBaseNetscapePluginStream.h:
        (WebNetscapePluginStream::create):
        * Plugins/WebBaseNetscapePluginStream.mm:
        (WebNetscapePluginStream::WebNetscapePluginStream):
        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView pluginView:receivedResponse:]):
        (-[WebBaseNetscapePluginView evaluateJavaScriptPluginRequest:]):
        (-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37983 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bcca41db
2008-10-29 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig.
Remove the WebBaseNetscapePluginStream Objective-C object.
* Plugins/WebBaseNetscapePluginStream.h:
(WebNetscapePluginStream::create):
* Plugins/WebBaseNetscapePluginStream.mm:
(WebNetscapePluginStream::WebNetscapePluginStream):
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView pluginView:receivedResponse:]):
(-[WebBaseNetscapePluginView evaluateJavaScriptPluginRequest:]):
(-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]):
2008-10-29 Brady Eidson <beidson@apple.com>
Reviewed by Sam Weinig
......
......@@ -45,19 +45,18 @@ namespace WebCore {
@class WebBaseNetscapePluginView;
@class NSURLResponse;
@class WebBaseNetscapePluginStream;
class WebNetscapePluginStream : public RefCounted<WebNetscapePluginStream>
, private WebCore::NetscapePlugInStreamLoaderClient
{
public:
static PassRefPtr<WebNetscapePluginStream> create(WebBaseNetscapePluginStream *stream, NSURLRequest *request, NPP plugin, bool sendNotification, void* notifyData)
static PassRefPtr<WebNetscapePluginStream> create(NSURLRequest *request, NPP plugin, bool sendNotification, void* notifyData)
{
return adoptRef(new WebNetscapePluginStream(stream, request, plugin, sendNotification, notifyData));
return adoptRef(new WebNetscapePluginStream(request, plugin, sendNotification, notifyData));
}
static PassRefPtr<WebNetscapePluginStream> create(WebBaseNetscapePluginStream *stream, WebCore::FrameLoader* frameLoader)
static PassRefPtr<WebNetscapePluginStream> create(WebCore::FrameLoader* frameLoader)
{
return adoptRef(new WebNetscapePluginStream(stream, frameLoader));
return adoptRef(new WebNetscapePluginStream(frameLoader));
}
virtual ~WebNetscapePluginStream();
......@@ -78,11 +77,13 @@ public:
void startStreamWithResponse(NSURLResponse *response);
// FIXME: These should all be private once WebBaseNetscapePluginStream is history...
public:
void didReceiveData(WebCore::NetscapePlugInStreamLoader*, const char* bytes, int length);
void destroyStreamWithError(NSError *);
void didFinishLoading(WebCore::NetscapePlugInStreamLoader*);
private:
void destroyStream();
void cancelLoadWithError(NSError *);
void destroyStreamWithError(NSError *);
void destroyStreamWithReason(NPReason);
void deliverDataToFile(NSData *data);
void deliverData();
......@@ -93,9 +94,7 @@ public:
// NetscapePlugInStreamLoaderClient methods.
void didReceiveResponse(WebCore::NetscapePlugInStreamLoader*, const WebCore::ResourceResponse&);
void didReceiveData(WebCore::NetscapePlugInStreamLoader*, const char* bytes, int length);
void didFail(WebCore::NetscapePlugInStreamLoader*, const WebCore::ResourceError&);
void didFinishLoading(WebCore::NetscapePlugInStreamLoader*);
bool wantsAllStreams() const;
RetainPtr<NSMutableData> m_deliveryData;
......@@ -125,27 +124,8 @@ public:
void deliverDataTimerFired(WebCore::Timer<WebNetscapePluginStream>* timer);
WebCore::Timer<WebNetscapePluginStream> m_deliverDataTimer;
// FIXME: Remove this once it's not needed anymore.
WebBaseNetscapePluginStream *m_pluginStream;
private:
WebNetscapePluginStream(WebBaseNetscapePluginStream *, WebCore::FrameLoader*);
WebNetscapePluginStream(WebBaseNetscapePluginStream *, NSURLRequest *, NPP, bool sendNotification, void* notifyData);
WebNetscapePluginStream(WebCore::FrameLoader*);
WebNetscapePluginStream(NSURLRequest *, NPP, bool sendNotification, void* notifyData);
};
@interface WebBaseNetscapePluginStream : NSObject
{
RefPtr<WebNetscapePluginStream> _impl;
}
- (WebNetscapePluginStream *)impl;
- (id)initWithFrameLoader:(WebCore::FrameLoader *)frameLoader;
- (id)initWithRequest:(NSURLRequest *)theRequest
plugin:(NPP)thePlugin
notifyData:(void *)theNotifyData
sendNotification:(BOOL)sendNotification;
@end
#endif
......@@ -60,15 +60,6 @@ static StreamMap& streams()
return staticStreams;
}
@implementation WebBaseNetscapePluginStream
#ifndef BUILDING_ON_TIGER
+ (void)initialize
{
WebCoreObjCFinalizeOnMainThread(self);
}
#endif
NPP WebNetscapePluginStream::ownerForStream(NPStream *stream)
{
return streams().get(stream);
......@@ -107,21 +98,7 @@ NSError *WebNetscapePluginStream::errorForReason(NPReason reason) const
return pluginCancelledConnectionError();
}
- (NSError *)errorForReason:(NPReason)theReason
{
return _impl->errorForReason(theReason);
}
- (id)initWithFrameLoader:(FrameLoader *)frameLoader
{
[super init];
_impl = WebNetscapePluginStream::create(self, frameLoader);
return self;
}
WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *stream, WebCore::FrameLoader* frameLoader)
WebNetscapePluginStream::WebNetscapePluginStream(FrameLoader* frameLoader)
: m_plugin(0)
, m_transferMode(0)
, m_offset(0)
......@@ -137,12 +114,11 @@ WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *st
, m_request(0)
, m_pluginFuncs(0)
, m_deliverDataTimer(this, &WebNetscapePluginStream::deliverDataTimerFired)
, m_pluginStream(stream)
{
memset(&m_stream, 0, sizeof(NPStream));
}
WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *stream, NSURLRequest *request, NPP plugin, bool sendNotification, void* notifyData)
WebNetscapePluginStream::WebNetscapePluginStream(NSURLRequest *request, NPP plugin, bool sendNotification, void* notifyData)
: m_requestURL([request URL])
, m_plugin(0)
, m_transferMode(0)
......@@ -159,7 +135,6 @@ WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *st
, m_request([request mutableCopy])
, m_pluginFuncs(0)
, m_deliverDataTimer(this, &WebNetscapePluginStream::deliverDataTimerFired)
, m_pluginStream(stream)
{
memset(&m_stream, 0, sizeof(NPStream));
......@@ -182,16 +157,6 @@ WebNetscapePluginStream::WebNetscapePluginStream(WebBaseNetscapePluginStream *st
m_loader->setShouldBufferData(false);
}
- (id)initWithRequest:(NSURLRequest *)theRequest
plugin:(NPP)thePlugin
notifyData:(void *)theNotifyData
sendNotification:(BOOL)flag
{
_impl = WebNetscapePluginStream::create(self, theRequest, thePlugin, flag, theNotifyData);
return self;
}
WebNetscapePluginStream::~WebNetscapePluginStream()
{
ASSERT(!m_plugin);
......@@ -212,21 +177,6 @@ WebNetscapePluginStream::~WebNetscapePluginStream()
streams().remove(&m_stream);
}
- (void)dealloc
{
ASSERT(_impl);
[super dealloc];
}
- (void)finalize
{
ASSERT_MAIN_THREAD();
ASSERT(_impl);
[super finalize];
}
void WebNetscapePluginStream::setPlugin(NPP plugin)
{
if (plugin) {
......@@ -662,13 +612,6 @@ void WebNetscapePluginStream::didReceiveData(NetscapePlugInStreamLoader*, const
[data release];
}
- (WebNetscapePluginStream *)impl
{
return _impl.get();
}
@end
static NSString *CarbonPathFromPOSIXPath(NSString *posixPath)
{
// Doesn't add a trailing colon for directories; this is a problem for paths to a volume,
......
......@@ -1756,7 +1756,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
ASSERT(_loadManually);
ASSERT(!_manualStream);
_manualStream = WebNetscapePluginStream::create(0, core([self webFrame])->loader());
_manualStream = WebNetscapePluginStream::create(core([self webFrame])->loader());
}
- (void)pluginView:(NSView *)pluginView receivedData:(NSData *)data
......@@ -2020,7 +2020,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
// Don't call NPP_NewStream and other stream methods if there is no JS result to deliver. This is what Mozilla does.
NSData *JSData = [result dataUsingEncoding:NSUTF8StringEncoding];
RefPtr<WebNetscapePluginStream> stream = WebNetscapePluginStream::create(0, [NSURLRequest requestWithURL:URL], plugin, [JSPluginRequest sendNotification], [JSPluginRequest notifyData]);
RefPtr<WebNetscapePluginStream> stream = WebNetscapePluginStream::create([NSURLRequest requestWithURL:URL], plugin, [JSPluginRequest sendNotification], [JSPluginRequest notifyData]);
RetainPtr<NSURLResponse> response(AdoptNS, [[NSURLResponse alloc] initWithURL:URL
MIMEType:@"text/plain"
......@@ -2181,7 +2181,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
[self performSelector:@selector(loadPluginRequest:) withObject:pluginRequest afterDelay:0];
[pluginRequest release];
} else {
RefPtr<WebNetscapePluginStream> stream = WebNetscapePluginStream::create(0, request, plugin, sendNotification, notifyData);
RefPtr<WebNetscapePluginStream> stream = WebNetscapePluginStream::create(request, plugin, sendNotification, notifyData);
streams.add(stream.get());
stream->start();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment