Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: third_party/WebKit/Source/platform/exported/WrappedResourceResponse.h

Issue 2117313002: Remove WebURLResponse::initialize() [revised] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanups Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 19 matching lines...) Expand all
30 30
31 #ifndef WrappedResourceResponse_h 31 #ifndef WrappedResourceResponse_h
32 #define WrappedResourceResponse_h 32 #define WrappedResourceResponse_h
33 33
34 #include "platform/exported/WebURLResponsePrivate.h" 34 #include "platform/exported/WebURLResponsePrivate.h"
35 #include "public/platform/WebURLResponse.h" 35 #include "public/platform/WebURLResponse.h"
36 #include "wtf/Allocator.h" 36 #include "wtf/Allocator.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 // WrappedResourceResponse doesn't take ownership of given ResourceResponse,
41 // but just holds a pointer to it. It is not copyable (as WebURLResponsePrivate
42 // is non-copyable).
40 class WrappedResourceResponse : public WebURLResponse { 43 class WrappedResourceResponse : public WebURLResponse {
41 public: 44 public:
42 ~WrappedResourceResponse() 45 ~WrappedResourceResponse() {}
46
47 explicit WrappedResourceResponse(ResourceResponse& resourceResponse)
48 : WebURLResponse(&m_handle)
43 { 49 {
44 reset(); // Need to drop reference to m_handle 50 m_handle.m_resourceResponse = &resourceResponse;
45 } 51 }
46 52
47 WrappedResourceResponse() { } 53 explicit WrappedResourceResponse(const ResourceResponse& resourceResponse)
48 54 : WrappedResourceResponse(const_cast<ResourceResponse&>(resourceResponse ))
49 WrappedResourceResponse(ResourceResponse& resourceResponse)
50 { 55 {
51 bind(resourceResponse);
52 }
53
54 WrappedResourceResponse(const ResourceResponse& resourceResponse)
55 {
56 bind(resourceResponse);
57 }
58
59 void bind(ResourceResponse& resourceResponse)
60 {
61 m_handle.m_resourceResponse = &resourceResponse;
62 assign(&m_handle);
63 }
64
65 void bind(const ResourceResponse& resourceResponse)
66 {
67 bind(*const_cast<ResourceResponse*>(&resourceResponse));
68 } 56 }
69 57
70 private: 58 private:
71 class Handle : public WebURLResponsePrivate { 59 // This is pointed by m_private.
72 DISALLOW_NEW(); 60 WebURLResponsePrivate m_handle;
73 public:
74 virtual void dispose() { m_resourceResponse = 0; }
75 };
76
77 Handle m_handle;
78 }; 61 };
79 62
80 } // namespace blink 63 } // namespace blink
81 64
82 #endif 65 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698