Commit ea18caae authored by ap@apple.com's avatar ap@apple.com

[Mac] Thread verifier assertions when printing

        https://bugs.webkit.org/show_bug.cgi?id=75738

        Reviewed by Sam Weinig.

        * UIProcess/API/mac/WKPrintingView.mm:
        (-[WKPrintingView dealloc]): Dealloc in main thread, so that WebFrameProxy doesn't get
        deref'ed from a secondary one.
        (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]): This method calls out to client,
        which only expects that on main thread.
        (-[WKPrintingView knowsPageRange:]): Call _adjustPrintingMarginsForHeaderAndFooter on main
        thread.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104334 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b87c01c8
2012-01-06 Alexey Proskuryakov <ap@apple.com>
[Mac] Thread verifier assertions when printing
https://bugs.webkit.org/show_bug.cgi?id=75738
Reviewed by Sam Weinig.
* UIProcess/API/mac/WKPrintingView.mm:
(-[WKPrintingView dealloc]): Dealloc in main thread, so that WebFrameProxy doesn't get
deref'ed from a secondary one.
(-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]): This method calls out to client,
which only expects that on main thread.
(-[WKPrintingView knowsPageRange:]): Call _adjustPrintingMarginsForHeaderAndFooter on main
thread.
2012-01-06 Alexey Proskuryakov <ap@apple.com> 2012-01-06 Alexey Proskuryakov <ap@apple.com>
Need to allow SCNetworkReachability service in sandbox profile Need to allow SCNetworkReachability service in sandbox profile
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#import "PrintInfo.h" #import "PrintInfo.h"
#import "WebData.h" #import "WebData.h"
#import "WebPageProxy.h" #import "WebPageProxy.h"
#import <WebCore/WebCoreObjCExtras.h>
#import <wtf/MainThread.h> #import <wtf/MainThread.h>
using namespace WebKit; using namespace WebKit;
...@@ -56,6 +57,14 @@ static BOOL isForcingPreviewUpdate; ...@@ -56,6 +57,14 @@ static BOOL isForcingPreviewUpdate;
return self; return self;
} }
- (void)dealloc
{
if (WebCoreObjCScheduleDeallocateOnMainThread([WKPrintingView class], self))
return;
[super dealloc];
}
- (BOOL)isFlipped - (BOOL)isFlipped
{ {
return YES; return YES;
...@@ -110,6 +119,8 @@ static BOOL isForcingPreviewUpdate; ...@@ -110,6 +119,8 @@ static BOOL isForcingPreviewUpdate;
- (void)_adjustPrintingMarginsForHeaderAndFooter - (void)_adjustPrintingMarginsForHeaderAndFooter
{ {
ASSERT(isMainThread()); // This funciton calls the client, which should only be done on main thread.
NSPrintInfo *info = [_printOperation printInfo]; NSPrintInfo *info = [_printOperation printInfo];
NSMutableDictionary *infoDictionary = [info dictionary]; NSMutableDictionary *infoDictionary = [info dictionary];
...@@ -364,7 +375,7 @@ static void prepareDataForPrintingOnSecondaryThread(void* untypedContext) ...@@ -364,7 +375,7 @@ static void prepareDataForPrintingOnSecondaryThread(void* untypedContext)
[self _suspendAutodisplay]; [self _suspendAutodisplay];
[self _adjustPrintingMarginsForHeaderAndFooter]; [self performSelectorOnMainThread:@selector(_adjustPrintingMarginsForHeaderAndFooter) withObject:nil waitUntilDone:YES];
if ([self _hasPageRects]) if ([self _hasPageRects])
*range = NSMakeRange(1, _printingPageRects.size()); *range = NSMakeRange(1, _printingPageRects.size());
......
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