| Index: third_party/grpc/src/objective-c/ProtoRPC/ProtoService.m
|
| diff --git a/third_party/WebKit/Source/platform/Prerender.cpp b/third_party/grpc/src/objective-c/ProtoRPC/ProtoService.m
|
| similarity index 50%
|
| copy from third_party/WebKit/Source/platform/Prerender.cpp
|
| copy to third_party/grpc/src/objective-c/ProtoRPC/ProtoService.m
|
| index 3e47c44c54528509f195260834e1f35430b1f7b0..fccc6aadc9cc8488d1f7b424795c7d9e5d1dc581 100644
|
| --- a/third_party/WebKit/Source/platform/Prerender.cpp
|
| +++ b/third_party/grpc/src/objective-c/ProtoRPC/ProtoService.m
|
| @@ -1,5 +1,7 @@
|
| /*
|
| - * Copyright (C) 2012 Google Inc. All rights reserved.
|
| + *
|
| + * Copyright 2015, Google Inc.
|
| + * All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -29,77 +31,51 @@
|
| *
|
| */
|
|
|
| -#include "platform/Prerender.h"
|
| -
|
| -#include "platform/PrerenderClient.h"
|
| -#include "public/platform/WebPrerender.h"
|
| -#include "public/platform/WebPrerenderingSupport.h"
|
| -
|
| -namespace blink {
|
| -
|
| -Prerender::Prerender(PrerenderClient* client, const KURL& url, const unsigned relTypes, const Referrer& referrer)
|
| - : m_client(client)
|
| - , m_url(url)
|
| - , m_relTypes(relTypes)
|
| - , m_referrer(referrer)
|
| -{
|
| -}
|
| -
|
| -Prerender::~Prerender()
|
| -{
|
| -}
|
| -
|
| -DEFINE_TRACE(Prerender)
|
| -{
|
| - visitor->trace(m_client);
|
| -}
|
| -
|
| -void Prerender::dispose()
|
| -{
|
| - m_client = nullptr;
|
| - m_extraData.clear();
|
| -}
|
| -
|
| -void Prerender::add()
|
| -{
|
| - if (WebPrerenderingSupport* platform = WebPrerenderingSupport::current())
|
| - platform->add(WebPrerender(this));
|
| -}
|
| +#import "ProtoService.h"
|
|
|
| -void Prerender::cancel()
|
| -{
|
| - if (WebPrerenderingSupport* platform = WebPrerenderingSupport::current())
|
| - platform->cancel(WebPrerender(this));
|
| -}
|
| +#import <RxLibrary/GRXWriteable.h>
|
| +#import <RxLibrary/GRXWriter.h>
|
|
|
| -void Prerender::abandon()
|
| -{
|
| - if (WebPrerenderingSupport* platform = WebPrerenderingSupport::current())
|
| - platform->abandon(WebPrerender(this));
|
| -}
|
| +#import "ProtoMethod.h"
|
| +#import "ProtoRPC.h"
|
|
|
| -void Prerender::didStartPrerender()
|
| -{
|
| - if (m_client)
|
| - m_client->didStartPrerender();
|
| +@implementation ProtoService {
|
| + NSString *_host;
|
| + NSString *_packageName;
|
| + NSString *_serviceName;
|
| }
|
|
|
| -void Prerender::didStopPrerender()
|
| -{
|
| - if (m_client)
|
| - m_client->didStopPrerender();
|
| +- (instancetype)init {
|
| + return [self initWithHost:nil packageName:nil serviceName:nil];
|
| }
|
|
|
| -void Prerender::didSendLoadForPrerender()
|
| -{
|
| - if (m_client)
|
| - m_client->didSendLoadForPrerender();
|
| +// Designated initializer
|
| +- (instancetype)initWithHost:(NSString *)host
|
| + packageName:(NSString *)packageName
|
| + serviceName:(NSString *)serviceName {
|
| + if (!host || !serviceName) {
|
| + [NSException raise:NSInvalidArgumentException
|
| + format:@"Neither host nor serviceName can be nil."];
|
| + }
|
| + if ((self = [super init])) {
|
| + _host = [host copy];
|
| + _packageName = [packageName copy];
|
| + _serviceName = [serviceName copy];
|
| + }
|
| + return self;
|
| }
|
|
|
| -void Prerender::didSendDOMContentLoadedForPrerender()
|
| -{
|
| - if (m_client)
|
| - m_client->didSendDOMContentLoadedForPrerender();
|
| +- (ProtoRPC *)RPCToMethod:(NSString *)method
|
| + requestsWriter:(GRXWriter *)requestsWriter
|
| + responseClass:(Class)responseClass
|
| + responsesWriteable:(id<GRXWriteable>)responsesWriteable {
|
| + ProtoMethod *methodName = [[ProtoMethod alloc] initWithPackage:_packageName
|
| + service:_serviceName
|
| + method:method];
|
| + return [[ProtoRPC alloc] initWithHost:_host
|
| + method:methodName
|
| + requestsWriter:requestsWriter
|
| + responseClass:responseClass
|
| + responsesWriteable:responsesWriteable];
|
| }
|
| -
|
| -} // namespace blink
|
| +@end
|
|
|