equal
deleted
inserted
replaced
|
1 // |
|
2 // BrowserStatisticsWindowController.m |
|
3 // MiniBrowser |
|
4 // |
|
5 // Created by Sam Weinig on 4/21/10. |
|
6 // Copyright 2010 Apple Inc. All rights reserved. |
|
7 // |
|
8 |
|
9 #import "BrowserStatisticsWindowController.h" |
|
10 |
|
11 #import <WebKit2/WKContextPrivate.h> |
|
12 |
|
13 @implementation BrowserStatisticsWindowController |
|
14 |
|
15 - (id)initWithThreadedWKContextRef:(WKContextRef)threadContext processWKContextRef:(WKContextRef)processContext |
|
16 { |
|
17 if ((self = [super initWithWindowNibName:@"BrowserStatisticsWindow"])) { |
|
18 _threadContext = WKContextRetain(threadContext); |
|
19 _processContext = WKContextRetain(processContext); |
|
20 } |
|
21 |
|
22 return self; |
|
23 } |
|
24 |
|
25 - (void)dealloc |
|
26 { |
|
27 WKContextRelease(_threadContext); |
|
28 _threadContext = 0; |
|
29 |
|
30 WKContextRelease(_processContext); |
|
31 _processContext = 0; |
|
32 |
|
33 [super dealloc]; |
|
34 } |
|
35 |
|
36 - (void)windowDidLoad |
|
37 { |
|
38 [super windowDidLoad]; |
|
39 [self refreshStatistics:nil]; |
|
40 } |
|
41 |
|
42 - (IBAction)refreshStatistics:(id)sender |
|
43 { |
|
44 WKContextStatistics threadStats; |
|
45 WKContextGetStatistics(_threadContext, &threadStats); |
|
46 |
|
47 WKContextStatistics processStats; |
|
48 WKContextGetStatistics(_processContext, &processStats); |
|
49 |
|
50 [[_basicStatsMatrix cellWithTag:11] setIntValue:processStats.numberOfWKPages]; |
|
51 [[_basicStatsMatrix cellWithTag:12] setIntValue:processStats.numberOfWKFrames]; |
|
52 |
|
53 [[_basicStatsMatrix cellWithTag:21] setIntValue:threadStats.numberOfWKPages]; |
|
54 [[_basicStatsMatrix cellWithTag:22] setIntValue:threadStats.numberOfWKFrames]; |
|
55 |
|
56 } |
|
57 |
|
58 @end |